From 72805bbfc4726f43eb9c2f0cba2c4c86eef6c900 Mon Sep 17 00:00:00 2001 From: mswgen <54498184+mswgen@users.noreply.github.com> Date: Tue, 13 Feb 2024 11:09:25 +0900 Subject: [PATCH] provide an option to use real mac boot chime --- electron-builder.json | 2 +- src/index.ts | 13 +++++++++++-- src/renderer.ts | 8 ++++---- src/update/065-to-066.ts | 6 +++--- src/update/097-to-098.ts | 6 +++--- 5 files changed, 22 insertions(+), 13 deletions(-) diff --git a/electron-builder.json b/electron-builder.json index 7a1d7f9..249b5df 100644 --- a/electron-builder.json +++ b/electron-builder.json @@ -24,7 +24,7 @@ "!out", "!etc" ], - "buildNumber": "67", + "buildNumber": "74", "mac": { "category": "public.app-category-utilities", "electronLanguages": [ diff --git a/src/index.ts b/src/index.ts index a46bd5d..6788584 100644 --- a/src/index.ts +++ b/src/index.ts @@ -419,7 +419,16 @@ electron.ipcMain.on('download-kexts', async (evt, ocver, kexts, PID) => { }); electron.ipcMain.on('download-bindata', async (evt, ocver, kexts, PID) => { await cpexec(`cd ~; mkdir -p .oc-update/${PID}; cd .oc-update/${PID}; curl -L -s -o OcBinaryData-master.zip https://github.com/acidanthera/OcBinaryData/archive/refs/heads/master.zip; mkdir OcBinaryData-master; cd OcBinaryData-master; unzip ../OcBinaryData-master.zip`); - evt.reply('downloaded-bindata', ocver, kexts, PID); + electron.ipcMain.on('confirm-reply', async (event, pid, id, result) => { + if (pid == PID && id == 'bindata') { + if (result) { + await fs.promises.rm(`${os.homedir()}/.oc-update/${PID}/OcBinaryData-master/OcBinaryData-master/Resources/Audio/OCEFIAudio_VoiceOver_Boot.mp3`); + await fs.promises.copyFile(`${os.homedir()}/.oc-update/${PID}/OcBinaryData-master/OcBinaryData-master/Resources/Audio/AXEFIAudio_VoiceOver_Boot.mp3`, `${os.homedir()}/.oc-update/${PID}/OcBinaryData-master/OcBinaryData-master/Resources/Audio/OCEFIAudio_VoiceOver_Boot.mp3`); + } + evt.reply('downloaded-bindata', ocver, kexts, PID); + } + }); + window.webContents.send('confirm', PID, 'bindata', 'OpenCore 부팅음은 Mac의 실제 부팅음과 다르지만, 바이너리 데이터에는 OpenCore 부팅음과 Mac 부팅음이 모두 포함되어 있습니다. Mac 부팅음을 사용하시겠습니까?', 'The OpenCore boot chime is different from the real Mac boot chime, but both are included in the binary data. Would you like to use the real Mac boot chime?'); }); electron.ipcMain.on('create-backup', (evt, ocver, kexts, PID, dir) => { if (!fs.existsSync(`${os.homedir()}/EFI Backup`) || !fs.lstatSync(`${os.homedir()}/EFI Backup`).isDirectory()) fs.mkdirSync(`${os.homedir()}/EFI Backup`); @@ -731,4 +740,4 @@ electron.ipcMain.on('check-bootstrap', (evt, efidir) => { }); electron.ipcMain.on('quit', () => { app.quit(); -}); +}); \ No newline at end of file diff --git a/src/renderer.ts b/src/renderer.ts index c6a8b0a..9af58a7 100644 --- a/src/renderer.ts +++ b/src/renderer.ts @@ -61,13 +61,13 @@ async function sleep(ms: number) { } window.addEventListener('load', async () => { ipc = (window as any).electron.ipcRenderer; - ipc.on('alert', (_event: any, PID: number, version: number, ko: string, en: string) => { + ipc.on('alert', (_event: any, PID: number, id: string, ko: string, en: string) => { alert(isKorean ? ko : en); - ipc.send('alert-closed', PID, version); + ipc.send('alert-closed', PID, id); }); - ipc.on('confirm', (_event: any, PID: number, version: number, ko: string, en: string) => { + ipc.on('confirm', (_event: any, PID: number, id: string, ko: string, en: string) => { const result = confirm(isKorean ? ko : en); - ipc.send('confirm-reply', PID, version, result); + ipc.send('confirm-reply', PID, id, result); }); ipc.on('theme', (_event: any, isDark: boolean) => { if (isDark) { diff --git a/src/update/065-to-066.ts b/src/update/065-to-066.ts index 337e2b6..d79f0a9 100644 --- a/src/update/065-to-066.ts +++ b/src/update/065-to-066.ts @@ -6,8 +6,8 @@ export default { configPlistChange: true, exec: (file: string, _app: any, ipc: electron.IpcMain, webContents: electron.WebContents, PID: number): Promise => { return new Promise(resolve => { - ipc.on('alert-closed', (_event: any, pid: number, version: number) => { - if (version == 65 && pid == PID) { + ipc.on('alert-closed', (_event: any, pid: number, id: string) => { + if (id == '65' && pid == PID) { const plistParsed: any = plist.parse(fs.readFileSync(file, 'utf8')); const ocDir = file.split('/').slice(0, -1).join('/'); if (fs.existsSync(`${ocDir}/Bootstrap`)) { @@ -53,7 +53,7 @@ export default { resolve(null); } }); - webContents.send('alert', PID, 65, `경고: Bootstrap.efi 감지됨 + webContents.send('alert', PID, '65', `경고: Bootstrap.efi 감지됨 현재 Bootstrap.efi를 사용하고 있습니다. Bootstrap.efi는 0.6.6부터 LauncherOption으로 변경되었습니다. 업데이트하려면 Bootstrap.efi를 비활성화하고 NVRAM 초기화를 해야 합니다. 업데이트 후 재부팅 시 NVRAM 초기화를 진행해주세요.`, `Warning: Bootstrap.efi detected diff --git a/src/update/097-to-098.ts b/src/update/097-to-098.ts index 076273b..1191513 100644 --- a/src/update/097-to-098.ts +++ b/src/update/097-to-098.ts @@ -15,8 +15,8 @@ export default { // Changes of OpenCore 0.9.8 new Driver: FirmwareSettingsEntry.efi (confirm before adding) */ - ipc.on('confirm-reply', (_event: any, pid: number, version: number, confirm: boolean) => { - if (version == 97 && pid == PID) { + ipc.on('confirm-reply', (_event: any, pid: number, id: string, confirm: boolean) => { + if (id == '97' && pid == PID) { if (confirm) { // 1. add file fs.copyFileSync(path.join(os.homedir(), '.oc-update', PID.toString(), 'OpenCore', 'X64', 'EFI', 'OC', 'Drivers', 'FirmwareSettingsEntry.efi'), path.join(path.dirname(file), 'Drivers', 'FirmwareSettingsEntry.efi')); @@ -47,7 +47,7 @@ export default { resolve(null); } }); - webContents.send('confirm', PID, 97, `OpenCore 0.9.8에서 새로운 드라이버인 FirmwareSettingsEntry.efi가 추가되었습니다. + webContents.send('confirm', PID, '97', `OpenCore 0.9.8에서 새로운 드라이버인 FirmwareSettingsEntry.efi가 추가되었습니다. 이 드라이버는 OpenCore 부팅 화면에 UEFI 설정 진입을 위한 메뉴를 추가합니다. 이 드라이버를 추가하시겠습니까?`, `A new driver, FirmwareSettingsEntry.efi, has been added in OpenCore 0.9.8. This driver adds a menu to enter UEFI settings to the OpenCore boot screen.