Skip to content
This repository has been archived by the owner on Oct 11, 2024. It is now read-only.

Commit

Permalink
Audio device selection
Browse files Browse the repository at this point in the history
  • Loading branch information
igor725 committed May 18, 2024
1 parent 8b32654 commit a2fa414
Show file tree
Hide file tree
Showing 8 changed files with 31 additions and 6 deletions.
2 changes: 1 addition & 1 deletion README.md
Original file line number Diff line number Diff line change
Expand Up @@ -20,10 +20,10 @@ This is a launcher for [psOff, PlayStation 4 emulator](https://github.com/SysRay
+ Game's background music
+ Trophies system
+ Controllers/Keybind cofiguration
+ Audio device selection

## Planned features
+ Gamepad control support
+ Audio device selection
+ Custom themes

## How can I download it?
Expand Down
Binary file added bin/listaudio.exe
Binary file not shown.
5 changes: 4 additions & 1 deletion main.js
Original file line number Diff line number Diff line change
Expand Up @@ -10,6 +10,7 @@ const { Trophies, TrophySharedConfig, TrophyDataReader } = require('./libs/troph
const SCE_PIC_PATH = '/sce_sys/pic0.png';
const SCE_TROPHY_PATH = '/sce_sys/trophy/trophy00.trp';
const SCE_BGA_PATH = '/sce_sys/snd0.at9';
const LISTAUDIO_PATH = path.join(__dirname, '/bin/listaudio.exe');

let win = null;
let player = null;
Expand Down Expand Up @@ -352,9 +353,11 @@ app.whenReady().then(() => {

ipcMain.handle('reqcfg', () => config.getFullConfig());

ipcMain.handle('reqadev', () => JSON.parse(execSync(LISTAUDIO_PATH, { cwd: emupath })));

ipcMain.handle('opendir', async () => {
const { canceled, filePaths } = await dialog.showOpenDialog(win, { properties: ['openDirectory'] });
if (canceled) return null;
if (canceled) throw 'cancelled';
return filePaths[0];
});

Expand Down
1 change: 1 addition & 0 deletions preload.js
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,7 @@ contextBridge.exposeInMainWorld('electronAPI', {
addEventListener: (event, listener) => ipcRenderer.on(event, (evt, message) => listener(message)),
buildGameContextMenu: (data) => ipcRenderer.invoke('gamecontext', data),
readTrophies: (path) => ipcRenderer.invoke('opentrp', path),
requestAudioDevices: () => ipcRenderer.invoke('reqadev'),
requestConfig: () => ipcRenderer.invoke('reqcfg'),
selectFolder: () => ipcRenderer.invoke('opendir'),
});
12 changes: 11 additions & 1 deletion webroot/js/settings.js
Original file line number Diff line number Diff line change
Expand Up @@ -132,10 +132,20 @@ window._onLangReady = (() => {
}
};

window.electronAPI.requestConfig().then((msg) => {
window.electronAPI.requestConfig().then(async (msg) => {
saved_cfg = msg;
refillScanDirs(saved_cfg);

await window.electronAPI.requestAudioDevices().then((list) => {
const htels = [];

for (let i = 0; i < list.length; ++i) {
htels.push(`<option data-cfgvalue="${list[i]}">${list[i]}</option>`);
}

$('#madevice').innerHTML = htels.join();
});

{
const uselect = $('select[data-cfgkey="userIndex"]');
const inusers = $('#inusers');
Expand Down
4 changes: 3 additions & 1 deletion webroot/langs/en.json
Original file line number Diff line number Diff line change
Expand Up @@ -13,6 +13,7 @@
"launcher": {
"header": "Launcher settings",
"bgmvol": "Background music volume:",
"emupath": "Emulator path:",
"updch": "Update channel:",
"updfr": {
"label": "Update frequency:",
Expand Down Expand Up @@ -40,10 +41,11 @@
},
"troperk": "Trophy ERK:",
"mastervol": "Master volume:",
"masterdevice": "Audio device:",
"lang": "System language:",
"fullscreen": "Enable fullscreen:",
"inbackends": "Gamepad backend configuration:",
"keybinds": "Open keyboard bind settings",
"inbackends": "Gamepad backend configuration",
"wkeybind": {
"bindmessage": "Press key for {action}...",
"alerts": {
Expand Down
6 changes: 5 additions & 1 deletion webroot/langs/ru.json
Original file line number Diff line number Diff line change
Expand Up @@ -13,6 +13,7 @@
"launcher": {
"header": "Основные настройки",
"bgmvol": "Громкость фоновой музыки:",
"emupath": "Путь до эмулятора:",
"updch": "Канал обновлений:",
"updfr": {
"label": "Регулярность обновлений:",
Expand All @@ -39,9 +40,12 @@
}
},
"troperk": "Ключ трофеев:",
"masterdevice": "Вывода звука:",
"mastervol": "Общая громкость:",
"lang": "Язык системы:",
"fullscreen": "Полноэкранный режим:"
"fullscreen": "Полноэкранный режим:",
"keybinds": "Открыть настройки биндов клавиатуры",
"inbackends": "Настройка геймпада:"
},
"alerts": {
"ghtoken": "Nightly сборки требуют авторизации на GitHub! Хотите продолжить?\nПриложение откроет страницу для создания токена, вы должны создать fine-grained токен с любым названием и датой истечения. Оставьте все остальные поля без изменения и нажмите кнопку \"Generate token\" внизу страницы. Затем скопируйте сгенерированный токен в соответствующее поле в настройках.",
Expand Down
7 changes: 6 additions & 1 deletion webroot/settings.html
Original file line number Diff line number Diff line change
Expand Up @@ -25,7 +25,7 @@
<input id="ghtok" data-cfgfacility="launcher" data-cfgkey="github_token" type="password" />
</div>
<div class="row">
<label for="emupath">Emulator path:</label>
<label for="emupath" eo-translator="settings.launcher.emupath"></label>
<input id="emupath" data-cfgfacility="launcher" data-cfgkey="emu_path" type="text" />
<input data-setpathto="emupath" style="flex: 0;" type="button" value="..." />
</div>
Expand Down Expand Up @@ -82,6 +82,11 @@
<label for="trophykey" eo-translator="settings.emulator.troperk"></label>
<input id="trophykey" type="password" data-cfgfacility="emu_general" data-cfgkey="trophyKey" disabled />
</div>
<div class="row">
<label for="madevice" eo-translator="settings.emulator.masterdevice"></label>
<select data-cfgfacility="emu_audio" data-cfgkey="device" data-cfgtype="string" style="width: 100%;"
id="madevice"></select>
</div>
<div class="row">
<label for="mavolume" eo-translator="settings.emulator.mastervol"></label>
<input id="mavolume" type="range" data-cfgfacility="emu_audio" data-cfgkey="volume" data-cfgscale="0.01" min="0"
Expand Down

0 comments on commit a2fa414

Please sign in to comment.