Skip to content

Commit

Permalink
Full PC-98 support for linux! 🎉
Browse files Browse the repository at this point in the history
  • Loading branch information
wearrrrr committed May 27, 2023
1 parent aeb064a commit a3ba610
Show file tree
Hide file tree
Showing 11 changed files with 225 additions and 90 deletions.
3 changes: 3 additions & 0 deletions index.html
Original file line number Diff line number Diff line change
Expand Up @@ -33,6 +33,9 @@ <h2>Spinoffs</h2>
<div class="wine-manager">
<button id="wine-manager-btn" class="wine-manager-btn">Wine Manager</button>
</div>
<div class="dosbox-manager">
<button id="dosbox-manager-btn" class="dosbox-manager-btn">Install Dosbox</button>
</div>
</div>

<div id="app-info" class="information-page">
Expand Down
52 changes: 0 additions & 52 deletions index_old.html

This file was deleted.

1 change: 1 addition & 0 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,7 @@
"private": true,
"version": "0.0.0",
"type": "module",
"license": "MIT",
"scripts": {
"dev": "vite",
"build": "tsc && vite build",
Expand Down
2 changes: 1 addition & 1 deletion src-tauri/Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,7 @@ edition = "2021"
tauri-build = { version = "1.3", features = [] }

[dependencies]
tauri = { version = "1.3", features = ["dialog-all", "fs-create-dir", "fs-exists", "fs-remove-file", "http-all", "os-all", "path-all", "shell-all", "window-all"] }
tauri = { version = "1.3", features = ["dialog-all", "fs-copy-file", "fs-create-dir", "fs-exists", "fs-remove-file", "http-all", "os-all", "path-all", "shell-all", "window-all"] }
serde = { version = "1.0", features = ["derive"] }
serde_json = "1.0"
tauri-plugin-upload = { git = "https://github.com/tauri-apps/plugins-workspace", branch = "v1" }
Expand Down
20 changes: 18 additions & 2 deletions src-tauri/tauri.conf.json
Original file line number Diff line number Diff line change
Expand Up @@ -27,14 +27,29 @@
"cmd": "tar",
"args": true
},
{
"name": "unzip",
"cmd": "unzip",
"args": true
},
{
"name": "ln",
"cmd": "ln",
"args": true
},
{
"name": "dosbox-x",
"cmd": "dosbox-x",
"cmd": "$APPDATA/dosbox/dosbox-x",
"args": true
},
{
"name": "powershell",
"cmd": "powershell",
"args": true
},
{
"name": "chmod",
"cmd": "chmod",
"args": true
}
]
Expand All @@ -49,7 +64,8 @@
"createDir": true,
"exists": true,
"removeFile": true,
"scope": ["$APPDATA/wine/", "$APPDATA/wine/**", "$APPDATA/*"]
"copyFile": true,
"scope": ["$APPDATA/wine/", "$APPDATA/wine/**", "$APPDATA/*", "$APPDATA/dosbox/*", "$APPDATA/dosbox/**"]
},
"path": {
"all": true
Expand Down
13 changes: 9 additions & 4 deletions src/styles.css
Original file line number Diff line number Diff line change
Expand Up @@ -300,7 +300,7 @@ input:checked + .slider:before {
.next-arrow {
position: relative;
}
.clear-games, .wine-manager {
.clear-games, .wine-manager, .dosbox-manager {
position: relative;
width: 90%;
margin-top: 10px;
Expand Down Expand Up @@ -385,19 +385,24 @@ input:checked + .slider:before {
border: 1px solid rgb(74, 247, 88);
border-radius: 10px;
}
#progress-bar-progress {
#progress-bar-progress, #dosbox-progress-bar-progress {
width: 0%;
color: black;
background-color: rgb(74, 247, 88);
height: 100%;
transition: width 250ms ease-in-out;
border-radius: 9px;
display: flex;
justify-content: end;
align-items: center;
overflow: hidden;
}
#progress-bar-text {
#progress-bar-progress {
transition: width 250ms ease-in-out;
}
#dosbox-progress-bar-progress {
transition: width 150ms ease-in-out;
}
#progress-bar-text, #dosbox-progress-bar-text {
position: relative;
right: 5px;
font-size: 18px;
Expand Down
92 changes: 71 additions & 21 deletions src/ts/dashboard.ts
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,8 @@ import gamesManager from './lib/games';
import games from '../assets/games.json';
import { WebviewWindow } from "@tauri-apps/api/window"
import modalManager from './lib/modalManager';
import * as pc98manager from './lib/pc98manager';
import downloadDosbox from './lib/pc98manager';
// TODO: Support for .5 games

// const pc98Games = ['th01', 'th02', 'th03', 'th04', 'th05']
Expand All @@ -24,55 +26,99 @@ for (const [name, value] of Object.entries(games.spinoffs)) {
gamesManager.addGame(name, value, gamesGridSpinoffs);
}

var modal = modalManager.createNewModal({
var wineModal = modalManager.createNewModal({
footer: true,
stickyFooter: false,
closeMethods: [],
beforeClose: function() {
return true;
}
})
modal.setContent(`
});
wineModal.setContent(`
<h2 class="modal-title">Warning! No Wine builds installed! Open wine manager?</h2>
<div class="progress-bar" id="progress-bar">
<div id="progress-bar-progress"><p id="progress-bar-text">0%</p></div>
</div>`);
modal.addFooterBtn('Download', 'tingle-btn tingle-btn--primary', function() {
wineModal.addFooterBtn('Download', 'tingle-btn tingle-btn--primary', function() {
openWineManager()
modalManager.closeModal(modal)
modalManager.closeModal(wineModal)
});
wineModal.addFooterBtn(`Don't Download (Games won't launch!)`, 'tingle-btn tingle-btn--danger', function() {
modalManager.closeModal(wineModal)
});
modal.addFooterBtn(`Don't Download (Games won't launch!)`, 'tingle-btn tingle-btn--danger', function() {
modalManager.closeModal(modal)

function wineOpenModal() {
modalManager.openModal(wineModal);
}

var dosboxModal = modalManager.createNewModal({
footer: true,
stickyFooter: false,
closeMethods: [],
beforeClose: function() {
return true;
}
});
dosboxModal.setContent(`
<h2 class="modal-title">Download PC-98 Emulator now?</h2>
<div class="progress-bar" id="dosbox-progress-bar">
<div id="dosbox-progress-bar-progress"><p id="dosbox-progress-bar-text">0%</p></div>
</div>`);
dosboxModal.addFooterBtn('Download', 'tingle-btn tingle-btn--primary', function() {
pc98manager.default.downloadDosbox();
})
dosboxModal.addFooterBtn(`Don't Download (PC-98 games won't work!)`, 'tingle-btn tingle-btn--danger', function() {
modalManager.closeModal(dosboxModal)
})

function dosboxOpenModal() {
modalManager.openModal(dosboxModal);
}

const dosboxProgressBarProgress = document.getElementById("dosbox-progress-bar-progress") as HTMLDivElement;
const dosboxProgressBarText = document.getElementById("dosbox-progress-bar-text") as HTMLDivElement;

function dosboxUpdateProgressBar(totalDownloaded: number, total: number) {
const percentage = Math.round((totalDownloaded / total) * 100);
dosboxProgressBarProgress.style.width = percentage + "%";
dosboxProgressBarText.textContent = percentage + "%";
}

function dosboxFinalizeProgressBar() {
dosboxProgressBarProgress.style.width = "100%"
setTimeout(() => {
dosboxModal.close();
dosboxResetProgressBar();
}, 500);
}

function openModal() {
modalManager.openModal(modal);
function dosboxResetProgressBar() {
dosboxProgressBarProgress.style.width = "0%"
}


const progressBarProgress = document.getElementById("progress-bar-progress") as HTMLDivElement;
const progressBarText = document.getElementById("progress-bar-text") as HTMLDivElement;

function updateProgressBar(totalDownloaded: number, total: number) {
function wineUpdateProgressBar(totalDownloaded: number, total: number) {
const percentage = Math.round((totalDownloaded / total) * 100);
openWineManager();
progressBarProgress.style.width = percentage + "%";
progressBarText.textContent = percentage + "%";

}

function finalizeProgressBar() {
function wineFinalizeProgressBar() {
progressBarProgress.style.width = "100%"
setTimeout(() => {
modal.close();
wineModal.close();
}, 500);
}

function unzipBegin() {
function wineUnzipBegin() {
progressBarProgress.textContent = "Unzipping..."
}

function resetProgressBar() {
function wineResetProgressBar() {
progressBarProgress.style.width = "0%"
}

Expand All @@ -87,12 +133,16 @@ function openWineManager() {
}

const funcs = {
updateProgressBar,
finalizeProgressBar,
resetProgressBar,
openModal,
unzipBegin,
openWineManager
wineUpdateProgressBar,
wineFinalizeProgressBar,
wineResetProgressBar,
wineOpenModal,
wineUnzipBegin,
openWineManager,
dosboxOpenModal,
dosboxUpdateProgressBar,
dosboxFinalizeProgressBar,
dosboxResetProgressBar,
}

export default funcs;
4 changes: 4 additions & 0 deletions src/ts/lib/bottombar.ts
Original file line number Diff line number Diff line change
Expand Up @@ -10,6 +10,7 @@ const quickSettings = document.getElementById('quick-settings') as HTMLDivElemen
const notificationSlider = document.getElementById('notifications-slider') as HTMLInputElement;
const clearGames = document.getElementById('clear-games-btn') as HTMLButtonElement;
const wineManager = document.getElementById('wine-manager-btn') as HTMLButtonElement;
const dosboxManager = document.getElementById('dosbox-manager-btn') as HTMLButtonElement;

const osInfo = document.getElementById('os-info') as HTMLParagraphElement;
const kernelInfo = document.getElementById('kernel-info') as HTMLParagraphElement;
Expand Down Expand Up @@ -73,6 +74,9 @@ if (settingsDiv !== null) {
}
});
});
dosboxManager.addEventListener('click', () => {
dashboard.dosboxOpenModal();
})
wineManager.addEventListener('click', () => {
dashboard.openWineManager();
})
Expand Down
Loading

0 comments on commit a3ba610

Please sign in to comment.