mirror of
https://github.com/MrUnknownDE/VRCX.git
synced 2026-04-19 06:43:51 +02:00
Fix print cropping and Linux custom photo path
This commit is contained in:
@@ -191,7 +191,8 @@ namespace VRCX
|
||||
var ms = new MemoryStream(bytes);
|
||||
var print = await Image.LoadAsync(ms);
|
||||
// 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 size = new Size(1920, 1080);
|
||||
@@ -199,14 +200,7 @@ namespace VRCX
|
||||
print.Mutate(x => x.Crop(rectangle));
|
||||
await print.SaveAsPngAsync(tempPath);
|
||||
if (ScreenshotHelper.HasTXt(path))
|
||||
{
|
||||
var success = ScreenshotHelper.CopyTXt(path, tempPath);
|
||||
if (!success)
|
||||
{
|
||||
File.Delete(tempPath);
|
||||
return false;
|
||||
}
|
||||
}
|
||||
ScreenshotHelper.CopyTXt(path, tempPath);
|
||||
File.Move(tempPath, path, true);
|
||||
return true;
|
||||
}
|
||||
|
||||
@@ -14,9 +14,16 @@ namespace VRCX
|
||||
{
|
||||
public override string AddScreenshotMetadata(string path, string metadataString, string worldId, bool changeFilename = false)
|
||||
{
|
||||
var winePrefix = Path.Join(_vrcPrefixPath, "drive_c");
|
||||
var winePath = path.Substring(3).Replace("\\", "/");
|
||||
path = Path.Join(winePrefix, winePath);
|
||||
if (path.Length >= 3 && path[1] == ':' &&
|
||||
(path[2] == '\\' || path[2] == '/'))
|
||||
{
|
||||
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);
|
||||
if (!File.Exists(path) || !path.EndsWith(".png") || !fileName.StartsWith("VRChat_"))
|
||||
|
||||
Reference in New Issue
Block a user