Skip to content

Commit

Permalink
fix: app icon, build resource error
Browse files Browse the repository at this point in the history
  • Loading branch information
HoraceHuang-ui committed Jul 5, 2024
1 parent b9c5ed5 commit 485ecc5
Show file tree
Hide file tree
Showing 16 changed files with 97 additions and 14 deletions.
Binary file added build/icon.ico
Binary file not shown.
Binary file removed build/icon.png
Binary file not shown.
2 changes: 2 additions & 0 deletions electron-builder.json5
Original file line number Diff line number Diff line change
Expand Up @@ -20,6 +20,7 @@
},
win: {
requestedExecutionLevel: "requireAdministrator",
icon: "build/icon.ico",
target: [
{
target: "nsis",
Expand All @@ -41,6 +42,7 @@
"src/assets/elementIcons/*",
"src/assets/kleeLoading.gif",
"src/assets/failedEmojis/*",
"src/assets/zzzDialog/*",
"src/assets/gsbanner.png",
"src/assets/srbanner.jpg",
"src/assets/hi3banner.webp",
Expand Down
38 changes: 35 additions & 3 deletions electron/main/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -19,6 +19,7 @@ import regedit, { promisified as reg } from 'regedit'
import { SrRegInfo } from '../../src/types/starrail/srRegInfo'
import { GsRegInfo } from '../../src/types/genshin/gsRegInfo'
import { Hi3RegInfo } from '../../src/types/honkai3/hi3RegInfo'
import { ZZZRegInfo } from '../../src/types/zenless/zzzRegInfo'

regedit.setExternalVBSLocation('resources/regedit/vbs')

Expand All @@ -38,8 +39,8 @@ const enka = new EnkaClient({
//
process.env.DIST_ELECTRON = path.join(__dirname, '..')
process.env.DIST = path.join(process.env.DIST_ELECTRON, '../dist')
process.env.BUILD = process.env.VITE_DEV_SERVER_URL
? path.join(process.env.DIST_ELECTRON, '../build')
process.env.PUBLIC = process.env.VITE_DEV_SERVER_URL
? path.join(process.env.DIST_ELECTRON, '../public')
: process.env.DIST

// Disable GPU Acceleration for Windows 7
Expand Down Expand Up @@ -69,7 +70,7 @@ let tray = null
// fs.mkdir(imageFolder);
// }

const iconPath = path.join(process.env.BUILD, 'icon.png')
const iconPath = path.join(process.env.PUBLIC, 'favicon.ico')
const assetsPath = process.env.VITE_DEV_SERVER_URL
? '../../src/assets'
: path.join(__dirname, '../../../src/assets')
Expand Down Expand Up @@ -395,6 +396,37 @@ async function createWindow() {
})
})

ipcMain.on('reg:zzzSet', (_event, acc: string) => {
const account = JSON.parse(acc)

reg.putValue({
'HKCU\\Software\\miHoYo\\绝区零': {
MIHOYOSDK_ADL_PROD_CN_h3123967166: {
value: account.mihoyoSdk,
type: 'REG_BINARY',
},
},
})
})

ipcMain.handle('reg:zzzGet', async (): Promise<ZZZRegInfo> => {
console.log('get111')
return new Promise(resolve => {
console.log('get222')
regedit.list(['HKCU\\Software\\miHoYo\\绝区零']).on('data', entry => {
console.log('get333')
if (entry.data.exists && entry.data.values) {
resolve({
name: '',
// generalData: result.values.GENERAL_DATA_h2389025596.value as number[],
mihoyoSdk: entry.data.values.MIHOYOSDK_ADL_PROD_CN_h3123967166
.value as number[],
})
}
})
})
})

ipcMain.handle('reg:srGet', async (): Promise<SrRegInfo> => {
return new Promise(resolve => {
regedit
Expand Down
6 changes: 6 additions & 0 deletions electron/preload/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -68,6 +68,9 @@ contextBridge.exposeInMainWorld('reg', {
hi3Get: async () => {
return await ipcRenderer.invoke('reg:hi3Get')
},
zzzGet: async () => {
return await ipcRenderer.invoke('reg:zzzGet')
},
gsSet: (account: string) => {
ipcRenderer.send('reg:gsSet', account)
},
Expand All @@ -77,6 +80,9 @@ contextBridge.exposeInMainWorld('reg', {
hi3Set: (account: string) => {
ipcRenderer.send('reg:hi3Set', account)
},
zzzSet: (account: string) => {
ipcRenderer.send('reg:zzzSet', account)
},
})

function domReady(
Expand Down
2 changes: 1 addition & 1 deletion index.html
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@
<html lang="en">
<head>
<meta charset="UTF-8" />
<link rel="icon" type="image/svg+xml" href="/build/icon.png" />
<link rel="icon" type="image/svg+xml" href="/build/icon.ico" />
<meta name="viewport" content="width=device-width, initial-scale=1.0, maximum-scale=1.0, user-scalable=0" />
<meta http-equiv="Content-Security-Policy" content="script-src 'self' 'unsafe-inline' 'unsafe-eval';" />
<title>miXeD</title>
Expand Down
Binary file modified public/favicon.ico
Binary file not shown.
7 changes: 7 additions & 0 deletions src/assets/styles/fonts.css
Original file line number Diff line number Diff line change
Expand Up @@ -18,3 +18,10 @@
font-weight: normal;
font-style: normal;
}

@font-face {
font-family: "zzz-font";
src: url("./zzz.ttf");
font-weight: normal;
font-style: normal;
}
2 changes: 1 addition & 1 deletion src/components/TopHeader.vue
Original file line number Diff line number Diff line change
Expand Up @@ -83,7 +83,7 @@ const winMax = () => {
<template>
<div class="drag main-wrapper">
<div class="title-wrapper">
<img src="../../build/icon.png" />
<img src="../../build/icon.ico" />
<div class="title">miXeD · {{ pageNames[selection] }}</div>
</div>
<div class="no-drag icons-wrapper">
Expand Down
25 changes: 22 additions & 3 deletions src/pages/GamePage.vue
Original file line number Diff line number Diff line change
Expand Up @@ -28,6 +28,7 @@ import { SrRegInfo } from '../types/starrail/srRegInfo'
import { GsRegInfo } from '../types/genshin/gsRegInfo'
import { BgImageInfo } from '../types/launcher/bgImageInfo'
import ZZZImportDialog from './ZZZPage/Components/ZZZImportDialog.vue'
import ZZZDialog from './ZZZPage/Components/ZZZDialog.vue'
const store = useStore()
Expand Down Expand Up @@ -135,7 +136,7 @@ const defDialogComponent = (game: string) => {
dialogComponent = Honkai3Dialog
break
case 'zzz':
dialogComponent = ZZZImportDialog
dialogComponent = ZZZDialog
break
default:
defDialogComponent(store.settings.appearance.dialogStyle)
Expand Down Expand Up @@ -320,7 +321,11 @@ const launchGame = async () => {
await window.reg.hi3Set(
JSON.stringify(gameStore.value.accounts[gameStore.value.curAccountId]),
)
}
} /* else if (gameNo.value == 3) {
await window.reg.zzzSet(
JSON.stringify(gameStore.value.accounts[gameStore.value.curAccountId]),
)
} */
}
await window.child.exec(gameStore.value.gamePath!)
if (store.settings.general.trayOnLaunch) {
Expand Down Expand Up @@ -381,13 +386,27 @@ const retrieveAccount = async () => {
mihoyoSdk: [],
})
}
}
} /* else if (gameNo.value == 3) {
const res = await window.reg.zzzGet()
if (res) {
gameStore.value.accounts.push({
name: newAccountName.value,
mihoyoSdk: res.mihoyoSdk,
})
} else {
gameStore.value.accounts.push({
name: newAccountName.value,
mihoyoSdk: [],
})
}
} */
dispose()
},
},
{
title: translate('general_addAccountTitle'),
msg: translate('general_addAccountMsg'),
styleType: 'normal',
showCancel: true,
closeOnOk: false,
hScale: hScale,
Expand Down
5 changes: 5 additions & 0 deletions src/pages/GamepadPage/GamepadPage.vue
Original file line number Diff line number Diff line change
Expand Up @@ -180,6 +180,11 @@ const launch = async (game: string, launcher: boolean) => {
}
} else {
gameStore = store.game.zzz
// if (gameStore.curAccountId != -1) {
// await window.reg.zzzSet(
// JSON.stringify(gameStore.accounts[gameStore.curAccountId]),
// )
// }
}
await window.child.exec(gameStore.gamePath)
Expand Down
8 changes: 4 additions & 4 deletions src/pages/ZZZPage/Components/ZZZButton.vue
Original file line number Diff line number Diff line change
Expand Up @@ -44,8 +44,8 @@ const backgroundColor: Record<number, string> = {
class="w-full h-full"
:src="
state == 0
? '../../../src/assets/zzzDialog/zzzDialogCancel.png'
: '../../../src/assets/zzzDialog/zzzDialogCancelActive.png'
? '../../src/assets/zzzDialog/zzzDialogCancel.png'
: '../../src/assets/zzzDialog/zzzDialogCancelActive.png'
"
/>
</div>
Expand All @@ -63,8 +63,8 @@ const backgroundColor: Record<number, string> = {
class="w-full h-full"
:src="
state == 0
? '../../../src/assets/zzzDialog/zzzDialogOk.png'
: '../../../src/assets/zzzDialog/zzzDialogOkActive.png'
? '../../src/assets/zzzDialog/zzzDialogOk.png'
: '../../src/assets/zzzDialog/zzzDialogOkActive.png'
"
/>
</div>
Expand Down
4 changes: 2 additions & 2 deletions src/pages/ZZZPage/Components/ZZZDialog.vue
Original file line number Diff line number Diff line change
Expand Up @@ -239,13 +239,13 @@ defineExpose({
@apply px-6 mx-[8px] mt-[8px];
& > .text {
@apply text-center w-full font-bold;
@apply text-center w-full font-bold text-white;
font-size: larger;
}
}
.contents-wrapper {
@apply px-6 pt-6 pb-4;
@apply px-6 pt-6 pb-4 text-white;
}
.buttons-wrapper {
Expand Down
2 changes: 2 additions & 0 deletions src/store/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -66,6 +66,8 @@ export const useStore = defineStore('userStore', {
launcherPath: undefined,
gamePath: undefined,
upd: false,
// accounts: [] as ZZZRegInfo[],
// curAccountId: -1,
},
} as Record<string, any>,
}),
Expand Down
3 changes: 3 additions & 0 deletions src/types/index.d.ts
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
import { GsRegInfo } from './genshin/gsRegInfo'
import { SrRegInfo } from './starrail/srRegInfo'
import { Hi3RegInfo } from './honkai3/hi3RegInfo'
import { ZZZRegInfo } from './zenless/zzzRegInfo'

export {}

Expand Down Expand Up @@ -53,6 +54,8 @@ export interface IReg {
srSet: (data: string) => Promise<void>
hi3Get: () => Promise<Hi3RegInfo | undefined>
hi3Set: (data: string) => Promise<void>
zzzGet: () => Promise<ZZZRegInfo | undefined>
zzzSet: (data: string) => Promise<void>
}

declare global {
Expand Down
7 changes: 7 additions & 0 deletions src/types/zenless/zzzRegInfo.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
export interface ZZZRegInfo {
name: string
// GENERAL_DATA_h2389025596
// generalData: number[]
// MIHOYOSDK_ADL_PROD_CN_h3123967166
mihoyoSdk: number[]
}

0 comments on commit 485ecc5

Please sign in to comment.