Only apply font change when running under wine

This commit is contained in:
Natsumi
2024-11-30 23:33:15 +13:00
parent c4efb515e3
commit 110471c69c
15 changed files with 129 additions and 33 deletions

View File

@@ -603,5 +603,10 @@ namespace VRCX
return await ImageCache.SaveImageToFile(url, filePath);
}
public bool IsRunningUnderWine()
{
return Wine.GetIfWine();
}
}
}

View File

@@ -80,5 +80,10 @@ namespace VRCX
output = filePath;
return output;
}
public bool IsRunningUnderWine()
{
return Wine.GetIfWine();
}
}
}

View File

@@ -26,6 +26,11 @@ namespace VRCX
{
var isGameRunning = false;
var isSteamVRRunning = false;
if (ProcessMonitor.Instance.IsProcessRunning("VRChat"))
{
isGameRunning = true;
}
if (Wine.GetIfWine())
{
@@ -39,13 +44,6 @@ namespace VRCX
}
}
}
else
{
if (ProcessMonitor.Instance.IsProcessRunning("VRChat"))
{
isGameRunning = true;
}
}
if (ProcessMonitor.Instance.IsProcessRunning("vrserver"))
{

View File

@@ -11,6 +11,7 @@ using CefSharp.Structs;
using SharpDX.Direct3D11;
using System;
using System.Threading;
using NLog;
using SharpDX.Direct3D;
using SharpDX.Mathematics.Interop;
using Range = CefSharp.Structs.Range;
@@ -24,6 +25,8 @@ namespace VRCX
private DeviceMultithread _deviceMultithread;
private Query _query;
private Texture2D _renderTarget;
private static readonly Logger logger = LogManager.GetCurrentClassLogger();
public OffScreenBrowser(string address, int width, int height)
: base(address, automaticallyCreateBrowser: false)
@@ -101,11 +104,20 @@ namespace VRCX
if (_device == null)
return;
using Texture2D cefTexture = _device1.OpenSharedResource1<Texture2D>(paintInfo.SharedTextureHandle);
_device.ImmediateContext.CopyResource(cefTexture, _renderTarget);
_device.ImmediateContext.End(_query);
_device.ImmediateContext.Flush();
try
{
using Texture2D cefTexture = _device1.OpenSharedResource1<Texture2D>(paintInfo.SharedTextureHandle);
_device.ImmediateContext.CopyResource(cefTexture, _renderTarget);
_device.ImmediateContext.End(_query);
_device.ImmediateContext.Flush();
}
catch (Exception e)
{
logger.Error(e);
_device = null;
return;
}
RawBool q = _device.ImmediateContext.GetData<RawBool>(_query, AsynchronousFlags.DoNotFlush);

View File

@@ -837,16 +837,16 @@ namespace VRCX
public override void ExecuteVrFeedFunction(string function, string json)
{
if (_wristOverlay == null) return;
if (_wristOverlay.IsLoading)
Restart();
// if (_wristOverlay.IsLoading)
// Restart();
_wristOverlay.ExecuteScriptAsync($"$app.{function}", json);
}
public override void ExecuteVrOverlayFunction(string function, string json)
{
if (_hmdOverlay == null) return;
if (_hmdOverlay.IsLoading)
Restart();
// if (_hmdOverlay.IsLoading)
// Restart();
_hmdOverlay.ExecuteScriptAsync($"$app.{function}", json);
}
}

View File

@@ -128,6 +128,7 @@ speechSynthesis.getVoices();
isGameNoVR: true,
isSteamVRRunning: false,
isHmdAfk: false,
isRunningUnderWine: false,
appVersion: '',
latestAppVersion: '',
shiftHeld: false
@@ -141,6 +142,7 @@ speechSynthesis.getVoices();
el: '#x-app',
async mounted() {
await this.initLanguage();
this.isRunningUnderWine = await AppApi.IsRunningUnderWine();
await this.changeThemeMode();
await AppApi.SetUserAgent();
this.appVersion = await AppApi.GetVersion();
@@ -8166,6 +8168,20 @@ speechSynthesis.getVoices();
}
this.updateVRConfigVars();
await this.updatetrustColor();
await this.applyWineEmojis();
};
$app.methods.applyWineEmojis = async function () {
if (document.contains(document.getElementById('app-emoji-font'))) {
document.getElementById('app-emoji-font').remove();
}
if (this.isRunningUnderWine) {
var $appEmojiFont = document.createElement('link');
$appEmojiFont.setAttribute('id', 'app-emoji-font');
$appEmojiFont.rel = 'stylesheet';
$appEmojiFont.href = 'emoji.font.css';
document.head.appendChild($appEmojiFont);
}
};
$app.data.isStartAtWindowsStartup = await configRepository.getBool(

View File

@@ -131,7 +131,7 @@ input,
textarea,
select,
button {
font-family: 'Noto Sans JP', 'Noto Sans KR', 'Noto Sans TC', 'Noto Sans SC', 'Noto Color Emoji',
font-family: 'Noto Sans JP', 'Noto Sans KR', 'Noto Sans TC', 'Noto Sans SC',
'Meiryo UI', 'Malgun Gothic', 'Segoe UI', sans-serif;
line-height: normal;
}

View File

@@ -23,7 +23,7 @@ export default class extends baseClass {
nextClearVRCXCacheCheck: 0,
nextDiscordUpdate: 0,
nextAutoStateChange: 0,
nextGameRunningCheck: 0,
nextGameRunningCheck: 0
};
_methods = {
@@ -76,7 +76,10 @@ export default class extends baseClass {
this.nextAutoStateChange = 3;
this.updateAutoStateChange();
}
if (--this.nextGameRunningCheck <= 0) {
if (
this.isRunningUnderWine &&
--this.nextGameRunningCheck <= 0
) {
this.nextGameRunningCheck = 3;
AppApi.CheckGameRunning();
}

40
html/src/emoji.font.scss Normal file
View File

@@ -0,0 +1,40 @@
body,
input,
textarea,
select,
button {
font-family: 'Noto Sans JP', 'Noto Sans KR', 'Noto Sans TC', 'Noto Sans SC',
'Noto Color Emoji', 'Meiryo UI', 'Malgun Gothic', 'Segoe UI', sans-serif;
}
body {
--md-sys-typescale-headline-medium-font: 'Google Sans', 'Noto Sans',
'Noto Sans TC', 'Noto Sans JP', 'Noto Sans SC', 'Noto Color Emoji',
'Roboto', sans-serif;
--md-sys-typescale-headline-small-font: 'Google Sans', 'Noto Sans',
'Noto Sans TC', 'Noto Sans JP', 'Noto Sans SC', 'Noto Color Emoji',
'Roboto', sans-serif;
--md-sys-typescale-title-medium-font: 'Google Sans', 'Noto Sans',
'Noto Sans TC', 'Noto Sans JP', 'Noto Sans SC', 'Noto Color Emoji',
'Roboto', sans-serif;
--md-sys-typescale-label-large-font: 'Google Sans', 'Noto Sans',
'Noto Sans TC', 'Noto Sans JP', 'Noto Sans SC', 'Noto Color Emoji',
'Roboto', sans-serif;
--md-sys-typescale-label-medium-font: 'Google Sans', 'Noto Sans',
'Noto Sans TC', 'Noto Sans JP', 'Noto Sans SC', 'Noto Color Emoji',
'Roboto', sans-serif;
--md-sys-typescale-body-large-font: 'Google Sans', 'Noto Sans',
'Noto Sans TC', 'Noto Sans JP', 'Noto Sans SC', 'Noto Color Emoji',
'Roboto', sans-serif;
--md-sys-typescale-body-medium-font: 'Google Sans', 'Noto Sans',
'Noto Sans TC', 'Noto Sans JP', 'Noto Sans SC', 'Noto Color Emoji',
'Roboto', sans-serif;
--md-sys-typescale-body-small-font: 'Google Sans', 'Noto Sans',
'Noto Sans TC', 'Noto Sans JP', 'Noto Sans SC', 'Noto Color Emoji',
'Roboto', sans-serif;
}
:root {
--font: 'Poppins', 'Noto Sans JP', 'Noto Sans KR', 'Noto Sans TC',
'Noto Sans SC', 'Noto Color Emoji', sans-serif;
}

View File

@@ -55,49 +55,49 @@ body {
),
rgb(var(--md-sys-color-surface));
--md-sys-typescale-headline-medium-font: 'Google Sans', 'Noto Sans',
'Noto Sans TC', 'Noto Sans JP', 'Noto Sans SC', 'Noto Color Emoji', 'Roboto', sans-serif;
'Noto Sans TC', 'Noto Sans JP', 'Noto Sans SC', 'Roboto', sans-serif;
--md-sys-typescale-headline-medium-line-height: 36px;
--md-sys-typescale-headline-medium-size: 28px;
--md-sys-typescale-headline-medium-weight: 500;
--md-sys-typescale-headline-medium-tracking: 0;
--md-sys-typescale-headline-small-font: 'Google Sans', 'Noto Sans',
'Noto Sans TC', 'Noto Sans JP', 'Noto Sans SC', 'Noto Color Emoji', 'Roboto', sans-serif;
'Noto Sans TC', 'Noto Sans JP', 'Noto Sans SC', 'Roboto', sans-serif;
--md-sys-typescale-headline-small-line-height: 32px;
--md-sys-typescale-headline-small-size: 24px;
--md-sys-typescale-headline-small-weight: 500;
--md-sys-typescale-headline-small-tracking: 0;
--md-sys-typescale-title-medium-font: 'Google Sans', 'Noto Sans',
'Noto Sans TC', 'Noto Sans JP', 'Noto Sans SC', 'Noto Color Emoji', 'Roboto', sans-serif;
'Noto Sans TC', 'Noto Sans JP', 'Noto Sans SC', 'Roboto', sans-serif;
--md-sys-typescale-title-medium-line-height: 24px;
--md-sys-typescale-title-medium-size: 16px;
--md-sys-typescale-title-medium-weight: 600;
--md-sys-typescale-title-medium-tracking: 0.15px;
--md-sys-typescale-label-large-font: 'Google Sans', 'Noto Sans',
'Noto Sans TC', 'Noto Sans JP', 'Noto Sans SC', 'Noto Color Emoji', 'Roboto', sans-serif;
'Noto Sans TC', 'Noto Sans JP', 'Noto Sans SC', 'Roboto', sans-serif;
--md-sys-typescale-label-large-line-height: 20px;
--md-sys-typescale-label-large-size: 14px;
--md-sys-typescale-label-large-weight: 600;
--md-sys-typescale-label-large-tracking: 0.1px;
--md-sys-typescale-label-medium-font: 'Google Sans', 'Noto Sans',
'Noto Sans TC', 'Noto Sans JP', 'Noto Sans SC', 'Noto Color Emoji', 'Roboto', sans-serif;
'Noto Sans TC', 'Noto Sans JP', 'Noto Sans SC', 'Roboto', sans-serif;
--md-sys-typescale-label-medium-line-height: 16px;
--md-sys-typescale-label-medium-size: 12px;
--md-sys-typescale-label-medium-weight: 600;
--md-sys-typescale-label-medium-tracking: 0.5px;
--md-sys-typescale-body-large-font: 'Google Sans', 'Noto Sans',
'Noto Sans TC', 'Noto Sans JP', 'Noto Sans SC', 'Noto Color Emoji', 'Roboto', sans-serif;
'Noto Sans TC', 'Noto Sans JP', 'Noto Sans SC', 'Roboto', sans-serif;
--md-sys-typescale-body-large-line-height: 24px;
--md-sys-typescale-body-large-size: 16px;
--md-sys-typescale-body-large-weight: 400;
--md-sys-typescale-body-large-tracking: 0.5px;
--md-sys-typescale-body-medium-font: 'Google Sans', 'Noto Sans',
'Noto Sans TC', 'Noto Sans JP', 'Noto Sans SC', 'Noto Color Emoji', 'Roboto', sans-serif;
'Noto Sans TC', 'Noto Sans JP', 'Noto Sans SC', 'Roboto', sans-serif;
--md-sys-typescale-body-medium-line-height: 20px;
--md-sys-typescale-body-medium-size: 14px;
--md-sys-typescale-body-medium-weight: 400;
--md-sys-typescale-body-medium-tracking: 0.25px;
--md-sys-typescale-body-small-font: 'Google Sans', 'Noto Sans',
'Noto Sans TC', 'Noto Sans JP', 'Noto Sans SC', 'Noto Color Emoji', 'Roboto', sans-serif;
'Noto Sans TC', 'Noto Sans JP', 'Noto Sans SC', 'Roboto', sans-serif;
--md-sys-typescale-body-small-line-height: 16px;
--md-sys-typescale-body-small-size: 12px;
--md-sys-typescale-body-small-weight: 400;

View File

@@ -14,7 +14,7 @@
--lighter-lighter-lighter-lighter-bg: #857070;
--lighter-border: #aa6065;
--font: 'Poppins', 'Noto Sans JP', 'Noto Sans KR', 'Noto Sans TC',
'Noto Sans SC', 'Noto Color Emoji', sans-serif;
'Noto Sans SC', sans-serif;
}
body,
button,

View File

@@ -131,6 +131,7 @@ Vue.component('marquee-text', MarqueeText);
appType: location.href.substr(-1),
appLanguage: 'en',
currentCulture: 'en-nz',
isRunningUnderWine: false,
currentTime: new Date().toJSON(),
cpuUsageEnabled: false,
cpuUsage: 0,
@@ -169,7 +170,9 @@ Vue.component('marquee-text', MarqueeText);
},
watch: {},
el: '#x-app',
mounted() {
async mounted() {
this.isRunningUnderWine = await AppApiVr.IsRunningUnderWine();
await this.applyWineEmojis();
workerTimers.setTimeout(() => AppApiVr.VrInit(), 5000);
if (this.appType === '1') {
this.refreshCustomScript();
@@ -658,6 +661,19 @@ Vue.component('marquee-text', MarqueeText);
}
};
$app.methods.applyWineEmojis = async function () {
if (document.contains(document.getElementById('app-emoji-font'))) {
document.getElementById('app-emoji-font').remove();
}
if (this.isRunningUnderWine) {
var $appEmojiFont = document.createElement('link');
$appEmojiFont.setAttribute('id', 'app-emoji-font');
$appEmojiFont.rel = 'stylesheet';
$appEmojiFont.href = 'emoji.font.css';
document.head.appendChild($appEmojiFont);
}
};
$app.methods.trackingResultToClass = function (deviceStatus) {
switch (deviceStatus) {
case 'Uninitialized':

View File

@@ -59,7 +59,7 @@ html
span.extra
span.time {{ feed.created_at | formatDate }}
span.spin ▶️
span.name(v-text="feed.displayName" style="margin-left:20px")
span.name(v-text="feed.displayName" style="margin-left:30px")
div(v-else-if="feed.type === 'Location'" class="x-friend-item" :class="{ friend: feed.isFriend, favorite: feed.isFavorite }")
.detail
span.extra

View File

@@ -175,7 +175,7 @@ input,
textarea,
select,
button {
font-family: 'Noto Sans JP', 'Noto Sans KR', 'Noto Sans TC', 'Noto Sans SC', 'Noto Color Emoji',
font-family: 'Noto Sans JP', 'Noto Sans KR', 'Noto Sans TC', 'Noto Sans SC',
'Meiryo UI', 'Malgun Gothic', 'Segoe UI', sans-serif;
line-height: normal;
text-shadow:
@@ -350,8 +350,8 @@ i.x-user-status.busy {
.spin {
animation: rotation 2.5s infinite linear;
position: absolute;
width: 14px;
height: 28px;
width: 24px;
height: 30px;
}
@keyframes rotation {

View File

@@ -24,6 +24,7 @@ module.exports = {
'theme.material3': './src/theme.material3.scss',
flags: './src/flags.scss',
'animated-emoji': './src/animated-emoji.scss',
'emoji.font': './src/emoji.font.scss',
vr: {
import: ['./src/vr.js', './src/vr.scss'],
dependOn: 'vendor'