diff --git a/src/ObfuscatedString.php b/src/ObfuscatedString.php index 93409ad..5239169 100644 --- a/src/ObfuscatedString.php +++ b/src/ObfuscatedString.php @@ -28,7 +28,7 @@ public function getMappedContent(): string $this->deobfuscatedContent = ""; foreach (preg_split("/((\r?\n)|(\r\n?))/", $this->content) as $line) { - if (!preg_match("/^(\s*)at (.+)\.([^.]+)\(([^:]+):(\d+)\)(.*)$/", $line, $matches)) { + if (!preg_match("/^(\s*)at (?:\w+\/+)?(.+)\.([^.]+)\(([^:]+):(\d+)\)(.*)$/", $line, $matches)) { $this->deobfuscatedContent .= $line . "\n"; continue; } @@ -60,4 +60,4 @@ public function getMappedContent(): string return $this->deobfuscatedContent; } -} \ No newline at end of file +} diff --git a/test/Fabric/fabric.log b/test/Fabric/1.18.2-pre1.log similarity index 100% rename from test/Fabric/fabric.log rename to test/Fabric/1.18.2-pre1.log diff --git a/test/Fabric/fabric.mapped.log b/test/Fabric/1.18.2-pre1.mapped.log similarity index 100% rename from test/Fabric/fabric.mapped.log rename to test/Fabric/1.18.2-pre1.mapped.log diff --git a/test/Fabric/1.21.3-crash-report.mapped.txt b/test/Fabric/1.21.3-crash-report.mapped.txt new file mode 100644 index 0000000..3f68e6d --- /dev/null +++ b/test/Fabric/1.21.3-crash-report.mapped.txt @@ -0,0 +1,106 @@ +---- Minecraft Test Report ---- +// No hugs here, sorry + +Time: 2024-11-18 13:49:29 +Description: Level dump + +java.lang.Exception: dummy + at net.minecraft.server.world.ServerWorld.dump(ServerWorld.java:1424) + at net.minecraft.server.MinecraftServer.dump(MinecraftServer.java:1755) + at net.minecraft.server.MinecraftServer.method_64262(MinecraftServer.java:1845) + at net.minecraft.util.thread.ThreadExecutor.method_5386(ThreadExecutor.java:70) + at java.base/java.util.concurrent.CompletableFuture$AsyncSupply.run(CompletableFuture.java:1768) + at net.minecraft.server.ServerTask.run(ServerTask.java:18) + at net.minecraft.util.thread.ThreadExecutor.executeTask(ThreadExecutor.java:164) + at net.minecraft.util.thread.ReentrantThreadExecutor.executeTask(ReentrantThreadExecutor.java:23) + at net.minecraft.server.MinecraftServer.executeTask(MinecraftServer.java:889) + at net.minecraft.server.MinecraftServer.executeTask(MinecraftServer.java:180) + at net.minecraft.util.thread.ThreadExecutor.runTask(ThreadExecutor.java:138) + at net.minecraft.server.MinecraftServer.runOneTask(MinecraftServer.java:871) + at net.minecraft.server.MinecraftServer.runTask(MinecraftServer.java:865) + at net.minecraft.util.thread.ThreadExecutor.runTasks(ThreadExecutor.java:147) + at net.minecraft.server.MinecraftServer.runTasks(MinecraftServer.java:829) + at net.minecraft.server.MinecraftServer.runTasksTillTickEnd(MinecraftServer.java:836) + at net.minecraft.server.MinecraftServer.runServer(MinecraftServer.java:719) + at net.minecraft.server.MinecraftServer.method_29739(MinecraftServer.java:292) + at java.base/java.lang.Thread.run(Thread.java:1583) + + +A detailed walkthrough of the error, its code path and all known details is as follows: +--------------------------------------------------------------------------------------- + +-- Head -- +Thread: Server thread +Stacktrace: + at net.minecraft.server.world.ServerWorld.addDetailsToCrashReport(ServerWorld.java:1734) + +-- Affected level -- +Details: + All players: 0 total; [] + Chunk stats: 841 + Level dimension: minecraft:overworld + Level spawn location: World: (0,83,0), Section: (at 0,3,0 in 0,5,0; chunk contains blocks 0,-64,0 to 15,319,15), Region: (0,0; contains chunks 0,0 to 31,31, blocks 0,-64,0 to 511,319,511) + Level time: 828 game time, 828 day time + Level name: world + Level game mode: Game mode: survival (ID 0). Hardcore: false. Commands: false + Level weather: Rain time: 35904 (now: false), thunder time: 122733 (now: false) + Known server brands: fabric + Removed feature flags: + Level was modded: true + Level storage version: 0x04ABD - Anvil + Loaded entity count: 11 +Stacktrace: + at net.minecraft.server.world.ServerWorld.addDetailsToCrashReport(ServerWorld.java:1734) + at net.minecraft.server.world.ServerWorld.dump(ServerWorld.java:1425) + at net.minecraft.server.MinecraftServer.dump(MinecraftServer.java:1755) + at net.minecraft.server.MinecraftServer.method_64262(MinecraftServer.java:1845) + at net.minecraft.util.thread.ThreadExecutor.method_5386(ThreadExecutor.java:70) + at java.base/java.util.concurrent.CompletableFuture$AsyncSupply.run(CompletableFuture.java:1768) + at net.minecraft.server.ServerTask.run(ServerTask.java:18) + at net.minecraft.util.thread.ThreadExecutor.executeTask(ThreadExecutor.java:164) + at net.minecraft.util.thread.ReentrantThreadExecutor.executeTask(ReentrantThreadExecutor.java:23) + at net.minecraft.server.MinecraftServer.executeTask(MinecraftServer.java:889) + at net.minecraft.server.MinecraftServer.executeTask(MinecraftServer.java:180) + at net.minecraft.util.thread.ThreadExecutor.runTask(ThreadExecutor.java:138) + at net.minecraft.server.MinecraftServer.runOneTask(MinecraftServer.java:871) + at net.minecraft.server.MinecraftServer.runTask(MinecraftServer.java:865) + at net.minecraft.util.thread.ThreadExecutor.runTasks(ThreadExecutor.java:147) + at net.minecraft.server.MinecraftServer.runTasks(MinecraftServer.java:829) + at net.minecraft.server.MinecraftServer.runTasksTillTickEnd(MinecraftServer.java:836) + at net.minecraft.server.MinecraftServer.runServer(MinecraftServer.java:719) + at net.minecraft.server.MinecraftServer.method_29739(MinecraftServer.java:292) + at java.base/java.lang.Thread.run(Thread.java:1583) + +-- System Details -- +Details: + Minecraft Version: 1.21.3 + Minecraft Version ID: 1.21.3 + Operating System: Linux (amd64) version 5.15.0-117-generic + Java Version: 21.0.4, Eclipse Adoptium + Java VM Version: OpenJDK 64-Bit Server VM (mixed mode, sharing), Eclipse Adoptium + Memory: 1691637680 bytes (1613 MiB) / 2147483648 bytes (2048 MiB) up to 4294967296 bytes (4096 MiB) + CPUs: 2 + Processor Vendor: AuthenticAMD + Processor Name: AMD EPYC 7F72 24-Core Processor + Identifier: AuthenticAMD Family 23 Model 49 Stepping 0 + Microarchitecture: Zen 2 + Frequency (GHz): -0.00 + Number of physical packages: 1 + Number of physical CPUs: 24 + Number of logical CPUs: 48 + Graphics card #0 name: unknown + Graphics card #0 vendor: unknown + Graphics card #0 VRAM (MiB): 0.00 + Graphics card #0 deviceId: unknown + Graphics card #0 versionInfo: unknown + Virtual memory max (MiB): 129820.58 + Virtual memory used (MiB): 49954.62 + Swap memory total (MiB): 1024.00 + Swap memory used (MiB): 17.27 + Space in storage for jna.tmpdir (MiB): + Space in storage for org.lwjgl.system.SharedLibraryExtractPath (MiB): + Space in storage for io.netty.native.workdir (MiB): + Space in storage for java.io.tmpdir (MiB): available: 151150.00, total: 223120.39 + Space in storage for workdir (MiB): available: 151150.00, total: 223120.39 + JVM Flags: 2 total; -Xmx4096M -Xms2048M + diff --git a/test/Fabric/1.21.3-crash-report.txt b/test/Fabric/1.21.3-crash-report.txt new file mode 100644 index 0000000..84ff087 --- /dev/null +++ b/test/Fabric/1.21.3-crash-report.txt @@ -0,0 +1,105 @@ +---- Minecraft Test Report ---- +// No hugs here, sorry + +Time: 2024-11-18 13:49:29 +Description: Level dump + +java.lang.Exception: dummy + at knot//net.minecraft.class_3218.method_21625(class_3218.java:1424) + at knot//net.minecraft.server.MinecraftServer.method_21613(MinecraftServer.java:1755) + at knot//net.minecraft.server.MinecraftServer.method_64262(MinecraftServer.java:1845) + at knot//net.minecraft.class_1255.method_5386(class_1255.java:70) + at java.base/java.util.concurrent.CompletableFuture$AsyncSupply.run(CompletableFuture.java:1768) + at knot//net.minecraft.class_3738.run(class_3738.java:18) + at knot//net.minecraft.class_1255.method_18859(class_1255.java:164) + at knot//net.minecraft.class_4093.method_18859(class_4093.java:23) + at knot//net.minecraft.server.MinecraftServer.method_24306(MinecraftServer.java:889) + at knot//net.minecraft.server.MinecraftServer.method_18859(MinecraftServer.java:180) + at knot//net.minecraft.class_1255.method_16075(class_1255.java:138) + at knot//net.minecraft.server.MinecraftServer.method_20415(MinecraftServer.java:871) + at knot//net.minecraft.server.MinecraftServer.method_16075(MinecraftServer.java:865) + at knot//net.minecraft.class_1255.method_18857(class_1255.java:147) + at knot//net.minecraft.server.MinecraftServer.method_18857(MinecraftServer.java:829) + at knot//net.minecraft.server.MinecraftServer.method_16208(MinecraftServer.java:836) + at knot//net.minecraft.server.MinecraftServer.method_29741(MinecraftServer.java:719) + at knot//net.minecraft.server.MinecraftServer.method_29739(MinecraftServer.java:292) + at java.base/java.lang.Thread.run(Thread.java:1583) + + +A detailed walkthrough of the error, its code path and all known details is as follows: +--------------------------------------------------------------------------------------- + +-- Head -- +Thread: Server thread +Stacktrace: + at knot//net.minecraft.class_3218.method_8538(class_3218.java:1734) + +-- Affected level -- +Details: + All players: 0 total; [] + Chunk stats: 841 + Level dimension: minecraft:overworld + Level spawn location: World: (0,83,0), Section: (at 0,3,0 in 0,5,0; chunk contains blocks 0,-64,0 to 15,319,15), Region: (0,0; contains chunks 0,0 to 31,31, blocks 0,-64,0 to 511,319,511) + Level time: 828 game time, 828 day time + Level name: world + Level game mode: Game mode: survival (ID 0). Hardcore: false. Commands: false + Level weather: Rain time: 35904 (now: false), thunder time: 122733 (now: false) + Known server brands: fabric + Removed feature flags: + Level was modded: true + Level storage version: 0x04ABD - Anvil + Loaded entity count: 11 +Stacktrace: + at knot//net.minecraft.class_3218.method_8538(class_3218.java:1734) + at knot//net.minecraft.class_3218.method_21625(class_3218.java:1425) + at knot//net.minecraft.server.MinecraftServer.method_21613(MinecraftServer.java:1755) + at knot//net.minecraft.server.MinecraftServer.method_64262(MinecraftServer.java:1845) + at knot//net.minecraft.class_1255.method_5386(class_1255.java:70) + at java.base/java.util.concurrent.CompletableFuture$AsyncSupply.run(CompletableFuture.java:1768) + at knot//net.minecraft.class_3738.run(class_3738.java:18) + at knot//net.minecraft.class_1255.method_18859(class_1255.java:164) + at knot//net.minecraft.class_4093.method_18859(class_4093.java:23) + at knot//net.minecraft.server.MinecraftServer.method_24306(MinecraftServer.java:889) + at knot//net.minecraft.server.MinecraftServer.method_18859(MinecraftServer.java:180) + at knot//net.minecraft.class_1255.method_16075(class_1255.java:138) + at knot//net.minecraft.server.MinecraftServer.method_20415(MinecraftServer.java:871) + at knot//net.minecraft.server.MinecraftServer.method_16075(MinecraftServer.java:865) + at knot//net.minecraft.class_1255.method_18857(class_1255.java:147) + at knot//net.minecraft.server.MinecraftServer.method_18857(MinecraftServer.java:829) + at knot//net.minecraft.server.MinecraftServer.method_16208(MinecraftServer.java:836) + at knot//net.minecraft.server.MinecraftServer.method_29741(MinecraftServer.java:719) + at knot//net.minecraft.server.MinecraftServer.method_29739(MinecraftServer.java:292) + at java.base/java.lang.Thread.run(Thread.java:1583) + +-- System Details -- +Details: + Minecraft Version: 1.21.3 + Minecraft Version ID: 1.21.3 + Operating System: Linux (amd64) version 5.15.0-117-generic + Java Version: 21.0.4, Eclipse Adoptium + Java VM Version: OpenJDK 64-Bit Server VM (mixed mode, sharing), Eclipse Adoptium + Memory: 1691637680 bytes (1613 MiB) / 2147483648 bytes (2048 MiB) up to 4294967296 bytes (4096 MiB) + CPUs: 2 + Processor Vendor: AuthenticAMD + Processor Name: AMD EPYC 7F72 24-Core Processor + Identifier: AuthenticAMD Family 23 Model 49 Stepping 0 + Microarchitecture: Zen 2 + Frequency (GHz): -0.00 + Number of physical packages: 1 + Number of physical CPUs: 24 + Number of logical CPUs: 48 + Graphics card #0 name: unknown + Graphics card #0 vendor: unknown + Graphics card #0 VRAM (MiB): 0.00 + Graphics card #0 deviceId: unknown + Graphics card #0 versionInfo: unknown + Virtual memory max (MiB): 129820.58 + Virtual memory used (MiB): 49954.62 + Swap memory total (MiB): 1024.00 + Swap memory used (MiB): 17.27 + Space in storage for jna.tmpdir (MiB): + Space in storage for org.lwjgl.system.SharedLibraryExtractPath (MiB): + Space in storage for io.netty.native.workdir (MiB): + Space in storage for java.io.tmpdir (MiB): available: 151150.00, total: 223120.39 + Space in storage for workdir (MiB): available: 151150.00, total: 223120.39 + JVM Flags: 2 total; -Xmx4096M -Xms2048M diff --git a/test/Fabric/FabricTest.php b/test/Fabric/FabricTest.php index 1d3d323..f26c466 100644 --- a/test/Fabric/FabricTest.php +++ b/test/Fabric/FabricTest.php @@ -12,11 +12,22 @@ class FabricTest extends TestCase /** * @throws \Exception */ - public function testRemapLog(): void + public function testRemap1_18_2_pre1_log(): void { $url = (new FabricMavenMapLocator("1.18.2-pre1"))->findMappingURL(); $map = new GZURLYarnMap($url); - $log = new ObfuscatedString(file_get_contents("./test/Fabric/fabric.log"), $map); - self::assertEquals(file_get_contents("./test/Fabric/fabric.mapped.log"), $log->getMappedContent()); + $log = new ObfuscatedString(file_get_contents("./test/Fabric/1.18.2-pre1.log"), $map); + self::assertEquals(file_get_contents("./test/Fabric/1.18.2-pre1.mapped.log"), $log->getMappedContent()); } -} \ No newline at end of file + + /** + * @throws \Exception + */ + public function testRemap_1_21_3_crash_report(): void + { + $url = (new FabricMavenMapLocator("1.21.3"))->findMappingURL(); + $map = new GZURLYarnMap($url); + $log = new ObfuscatedString(file_get_contents("./test/Fabric/1.21.3-crash-report.txt"), $map); + self::assertEquals(file_get_contents("./test/Fabric/1.21.3-crash-report.mapped.txt"), $log->getMappedContent()); + } +}