Fix print cropping and Linux custom photo path

This commit is contained in:
Natsumi
2025-02-17 13:17:43 +13:00
parent 8ee28ea3ca
commit 60d8d7682f
10 changed files with 44 additions and 26 deletions

View File

@@ -191,7 +191,8 @@ namespace VRCX
var ms = new MemoryStream(bytes); var ms = new MemoryStream(bytes);
var print = await Image.LoadAsync(ms); var print = await Image.LoadAsync(ms);
// validation step to ensure image is actually a print // validation step to ensure image is actually a print
if (print.Width != 2048 || print.Height != 1440) return false; if (print.Width != 2048 || print.Height != 1440)
return false;
var point = new Point(64, 69); var point = new Point(64, 69);
var size = new Size(1920, 1080); var size = new Size(1920, 1080);
@@ -199,14 +200,7 @@ namespace VRCX
print.Mutate(x => x.Crop(rectangle)); print.Mutate(x => x.Crop(rectangle));
await print.SaveAsPngAsync(tempPath); await print.SaveAsPngAsync(tempPath);
if (ScreenshotHelper.HasTXt(path)) if (ScreenshotHelper.HasTXt(path))
{ ScreenshotHelper.CopyTXt(path, tempPath);
var success = ScreenshotHelper.CopyTXt(path, tempPath);
if (!success)
{
File.Delete(tempPath);
return false;
}
}
File.Move(tempPath, path, true); File.Move(tempPath, path, true);
return true; return true;
} }

View File

@@ -14,9 +14,16 @@ namespace VRCX
{ {
public override string AddScreenshotMetadata(string path, string metadataString, string worldId, bool changeFilename = false) public override string AddScreenshotMetadata(string path, string metadataString, string worldId, bool changeFilename = false)
{ {
var winePrefix = Path.Join(_vrcPrefixPath, "drive_c"); if (path.Length >= 3 && path[1] == ':' &&
var winePath = path.Substring(3).Replace("\\", "/"); (path[2] == '\\' || path[2] == '/'))
path = Path.Join(winePrefix, winePath); {
var driveLetter = path[0].ToString().ToLower();
var winePrefix = Path.Join(_vrcPrefixPath, $"dosdevices/{driveLetter}:");
var winePath = path[3..]; // remove C:\
path = Path.Join(winePrefix, winePath);
}
path = path.Replace("\\", "/");
var fileName = Path.GetFileNameWithoutExtension(path); var fileName = Path.GetFileNameWithoutExtension(path);
if (!File.Exists(path) || !path.EndsWith(".png") || !fileName.StartsWith("VRChat_")) if (!File.Exists(path) || !path.EndsWith(".png") || !fileName.StartsWith("VRChat_"))

View File

@@ -1,5 +1,7 @@
### Download and run AppImage from [Releases](https://github.com/vrcx-team/VRCX/releases) ### Download and run AppImage from [Releases](https://github.com/vrcx-team/VRCX/releases)
If you're using Fedora, you may need to reboot after installing .NET for [DOTNET_ROOT](https://src.fedoraproject.org/rpms/dotnet9.0/blob/rawhide/f/dotnet.sh.in#_3) environment variable to take affect.
--- ---
### Legacy Wine guide ### Legacy Wine guide

View File

@@ -10745,12 +10745,14 @@ console.log(`isLinux: ${LINUX}`);
this.currentInstanceWorld.instance = ref; this.currentInstanceWorld.instance = ref;
} else { } else {
var L = $utils.parseLocation(instanceId); var L = $utils.parseLocation(instanceId);
API.getInstance({ if (L.isRealInstance) {
worldId: L.worldId, API.getInstance({
instanceId: L.instanceId worldId: L.worldId,
}).then((args) => { instanceId: L.instanceId
this.currentInstanceWorld.instance = args.ref; }).then((args) => {
}); this.currentInstanceWorld.instance = args.ref;
});
}
} }
} }
}; };
@@ -17767,7 +17769,7 @@ console.log(`isLinux: ${LINUX}`);
$app.methods.refreshInstancePlayerCount = function (instance) { $app.methods.refreshInstancePlayerCount = function (instance) {
var L = $utils.parseLocation(instance); var L = $utils.parseLocation(instance);
if (L.worldId && L.instanceId) { if (L.isRealInstance) {
API.getInstance({ API.getInstance({
worldId: L.worldId, worldId: L.worldId,
instanceId: L.instanceId instanceId: L.instanceId
@@ -18611,7 +18613,9 @@ console.log(`isLinux: ${LINUX}`);
console.log(`Print saved to file: ${monthFolder}\\${fileName}`); console.log(`Print saved to file: ${monthFolder}\\${fileName}`);
if (this.cropInstancePrints) { if (this.cropInstancePrints) {
await AppApi.CropPrintImage(filePath); if (!await AppApi.CropPrintImage(filePath)) {
console.error('Failed to crop print image');
}
} }
} }
@@ -22318,7 +22322,7 @@ console.log(`isLinux: ${LINUX}`);
} }
if (!API.queuedInstances.has(instanceId)) { if (!API.queuedInstances.has(instanceId)) {
var L = $utils.parseLocation(instanceId); var L = $utils.parseLocation(instanceId);
if (L.worldId && L.instanceId) { if (L.isRealInstance) {
API.getInstance({ API.getInstance({
worldId: L.worldId, worldId: L.worldId,
instanceId: L.instanceId instanceId: L.instanceId

View File

@@ -96,9 +96,12 @@ export default class extends baseClass {
if (!$app.isGameRunning && json.presence) { if (!$app.isGameRunning && json.presence) {
if ($utils.isRealInstance(json.presence.world)) { if ($utils.isRealInstance(json.presence.world)) {
location = `${json.presence.world}:${json.presence.instance}`; location = `${json.presence.world}:${json.presence.instance}`;
travelingToLocation = `${json.presence.travelingToWorld}:${json.presence.travelingToInstance}`;
} else { } else {
location = json.presence.world; location = json.presence.world;
}
if ($utils.isRealInstance(json.presence.travelingToWorld)) {
travelingToLocation = `${json.presence.travelingToWorld}:${json.presence.travelingToInstance}`;
} else {
travelingToLocation = json.presence.travelingToWorld; travelingToLocation = json.presence.travelingToWorld;
} }
instanceId = json.presence.instance; instanceId = json.presence.instance;

View File

@@ -469,8 +469,8 @@ export default class extends baseClass {
template: template:
'<div @click="confirm" class="avatar-info">' + '<div @click="confirm" class="avatar-info">' +
'<span style="margin-right:5px">{{ avatarName }}</span>' + '<span style="margin-right:5px">{{ avatarName }}</span>' +
'<span style="margin-right:5px" :class="color">{{ avatarType }}</span>' + '<span v-if="avatarType" style="margin-right:5px" :class="color">{{ avatarType }}</span>' +
'<span style="color:#909399;font-family:monospace;font-size:12px;">{{ avatarTags }}</span>' + '<span v-if="avatarTags" style="color:#909399;font-family:monospace;font-size:12px;">{{ avatarTags }}</span>' +
'</div>', '</div>',
props: { props: {
imageurl: String, imageurl: String,

View File

@@ -89,6 +89,7 @@ export default {
return false; return false;
} }
switch (instanceId) { switch (instanceId) {
case ':':
case 'offline': case 'offline':
case 'offline:offline': case 'offline:offline':
case 'private': case 'private':

View File

@@ -742,6 +742,7 @@
"copy_id": "Copy ID", "copy_id": "Copy ID",
"copy_url": "Copy URL", "copy_url": "Copy URL",
"copy_display_name": "Copy DisplayName", "copy_display_name": "Copy DisplayName",
"vrcplus_hides_avatar": "When a VRC+ profile photo is set, avatar info is hidden. This also hides avatar changes in the feed",
"accuracy_notice": "Info from local database may not be accurate", "accuracy_notice": "Info from local database may not be accurate",
"instance_full": "full", "instance_full": "full",
"instance_closed": "closed", "instance_closed": "closed",

View File

@@ -441,7 +441,13 @@ mixin userDialog
avatar-info( avatar-info(
:imageurl='userDialog.ref.currentAvatarImageUrl' :imageurl='userDialog.ref.currentAvatarImageUrl'
:userid='userDialog.id' :userid='userDialog.id'
:avatartags='userDialog.ref.currentAvatarTags') :avatartags='userDialog.ref.currentAvatarTags'
style='display: inline-block')
el-tooltip(
v-if='userDialog.ref.profilePicOverride && !userDialog.ref.currentAvatarImageUrl && !hideTooltips'
placement='top'
:content='$t("dialog.user.info.vrcplus_hides_avatar")')
i.el-icon-warning
.x-friend-item(style='width: 100%; cursor: default') .x-friend-item(style='width: 100%; cursor: default')
.detail .detail
span.name(style='margin-bottom: 5px') {{ $t('dialog.user.info.represented_group') }} span.name(style='margin-bottom: 5px') {{ $t('dialog.user.info.represented_group') }}

View File

@@ -172,7 +172,7 @@ mixin friendsListSidebar
span(v-if='friend.isVIP' style='margin-left: 2px') ⭐ span(v-if='friend.isVIP' style='margin-left: 2px') ⭐
span.extra(v-if='friend.pendingOffline') #[i.el-icon-warning-outline] {{ $t('side_panel.pending_offline') }} span.extra(v-if='friend.pendingOffline') #[i.el-icon-warning-outline] {{ $t('side_panel.pending_offline') }}
template(v-else) template(v-else)
template(v-if='friend.ref.travelingToLocation') template(v-if='friend.ref.location === "traveling"')
i.el-icon.el-icon-loading( i.el-icon.el-icon-loading(
style='display: inline-block; margin-right: 5px') style='display: inline-block; margin-right: 5px')
timer.extra( timer.extra(