Skip to content

Commit

Permalink
provide an option to use real mac boot chime
Browse files Browse the repository at this point in the history
  • Loading branch information
dropdb220 committed Feb 13, 2024
1 parent 49473a3 commit 72805bb
Show file tree
Hide file tree
Showing 5 changed files with 22 additions and 13 deletions.
2 changes: 1 addition & 1 deletion electron-builder.json
Original file line number Diff line number Diff line change
Expand Up @@ -24,7 +24,7 @@
"!out",
"!etc"
],
"buildNumber": "67",
"buildNumber": "74",
"mac": {
"category": "public.app-category-utilities",
"electronLanguages": [
Expand Down
13 changes: 11 additions & 2 deletions src/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -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`);
Expand Down Expand Up @@ -731,4 +740,4 @@ electron.ipcMain.on('check-bootstrap', (evt, efidir) => {
});
electron.ipcMain.on('quit', () => {
app.quit();
});
});
8 changes: 4 additions & 4 deletions src/renderer.ts
Original file line number Diff line number Diff line change
Expand Up @@ -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) {
Expand Down
6 changes: 3 additions & 3 deletions src/update/065-to-066.ts
Original file line number Diff line number Diff line change
Expand Up @@ -6,8 +6,8 @@ export default {
configPlistChange: true,
exec: (file: string, _app: any, ipc: electron.IpcMain, webContents: electron.WebContents, PID: number): Promise<null> => {
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`)) {
Expand Down Expand Up @@ -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
Expand Down
6 changes: 3 additions & 3 deletions src/update/097-to-098.ts
Original file line number Diff line number Diff line change
Expand Up @@ -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'));
Expand Down Expand Up @@ -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.
Expand Down

0 comments on commit 72805bb

Please sign in to comment.