-
Notifications
You must be signed in to change notification settings - Fork 1
Commit
- Loading branch information
There are no files selected for viewing
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,38 @@ | ||
target/ | ||
!.mvn/wrapper/maven-wrapper.jar | ||
!**/src/main/**/target/ | ||
!**/src/test/**/target/ | ||
|
||
### IntelliJ IDEA ### | ||
.idea/modules.xml | ||
.idea/jarRepositories.xml | ||
.idea/compiler.xml | ||
.idea/libraries/ | ||
*.iws | ||
*.iml | ||
*.ipr | ||
|
||
### Eclipse ### | ||
.apt_generated | ||
.classpath | ||
.factorypath | ||
.project | ||
.settings | ||
.springBeans | ||
.sts4-cache | ||
|
||
### NetBeans ### | ||
/nbproject/private/ | ||
/nbbuild/ | ||
/dist/ | ||
/nbdist/ | ||
/.nb-gradle/ | ||
build/ | ||
!**/src/main/**/build/ | ||
!**/src/test/**/build/ | ||
|
||
### VS Code ### | ||
.vscode/ | ||
|
||
### Mac OS ### | ||
.DS_Store |
Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.
Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.
Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.
Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.
Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.
Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,25 @@ | ||
<?xml version="1.0" encoding="UTF-8"?> | ||
<project xmlns="https://maven.apache.org/POM/4.0.0" | ||
xmlns:xsi="https://www.w3.org/2001/XMLSchema-instance" | ||
xsi:schemaLocation="https://maven.apache.org/POM/4.0.0 https://maven.apache.org/xsd/maven-4.0.0.xsd"> | ||
<modelVersion>4.0.0</modelVersion> | ||
|
||
<groupId>tech.tenamen.zemplify.example</groupId> | ||
<artifactId>asm</artifactId> | ||
<version>1.0-SNAPSHOT</version> | ||
|
||
<dependencies> | ||
<dependency> | ||
<groupId>org.ow2.asm</groupId> | ||
<artifactId>asm</artifactId> | ||
<version>9.6</version> | ||
</dependency> | ||
</dependencies> | ||
|
||
<properties> | ||
<maven.compiler.source>8</maven.compiler.source> | ||
<maven.compiler.target>8</maven.compiler.target> | ||
<project.build.sourceEncoding>UTF-8</project.build.sourceEncoding> | ||
</properties> | ||
|
||
</project> |
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,62 @@ | ||
package tech.tenamen.zemplify.example; | ||
|
||
import org.objectweb.asm.*; | ||
|
||
import java.io.BufferedWriter; | ||
import java.io.FileWriter; | ||
import java.io.IOException; | ||
import java.io.PrintWriter; | ||
import java.nio.file.Files; | ||
import java.nio.file.Path; | ||
import java.nio.file.Paths; | ||
|
||
public class Main { | ||
|
||
|
||
public static void main(String[] args) { | ||
String filePath = "C:\\Users\\ryo\\Documents\\Github\\Java\\Zemplify\\ASMMain\\out\\artifacts\\asm_jar\\asm.jar"; // 実際のファイルパスに変更してください | ||
|
||
try { | ||
// ファイルのパスを指定してバイトコードを取得 | ||
byte[] bytecode = readClassFile(filePath); | ||
|
||
// FileWriterクラスのオブジェクトを生成する | ||
FileWriter file = new FileWriter("C:\\Users\\ryo\\Documents\\Github\\Java\\Zemplify\\Dll1\\Dll1\\jarBytes.h"); | ||
// PrintWriterクラスのオブジェクトを生成する | ||
PrintWriter pw = new PrintWriter(new BufferedWriter(file)); | ||
|
||
//ファイルに書き込む | ||
pw.println("#pragma once"); | ||
pw.print("const unsigned char data[] = { "); | ||
for (byte b : bytecode) { | ||
pw.printf("0x%02X, ", b); | ||
} | ||
pw.print((" };")); | ||
//ファイルを閉じる | ||
pw.close(); | ||
} catch (IOException e) { | ||
e.printStackTrace(); | ||
} | ||
} | ||
|
||
private static byte[] readClassFile(String filePath) throws IOException { | ||
Path path = Paths.get(filePath); | ||
return Files.readAllBytes(path); | ||
} | ||
|
||
public static byte[] main(byte[] classBytes, String windowName, String className) { | ||
switch (className) { | ||
case "net/minecraft/client/renderer/entity/player/PlayerRenderer": { | ||
System.out.println("PlayerRenderer"); | ||
break; | ||
} | ||
case "net/minecraft/client/renderer/GameRenderer": { | ||
System.out.println("GameRenderer"); | ||
break; | ||
} | ||
default: | ||
break; | ||
} | ||
return classBytes; | ||
} | ||
} |