Skip to content

Commit

Permalink
initialize
Browse files Browse the repository at this point in the history
  • Loading branch information
wevez committed Dec 1, 2023
1 parent 17dbf78 commit 1a058f9
Show file tree
Hide file tree
Showing 25 changed files with 15,132 additions and 0 deletions.
38 changes: 38 additions & 0 deletions ASMMain/.gitignore
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
3 changes: 3 additions & 0 deletions ASMMain/.idea/.gitignore

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

9 changes: 9 additions & 0 deletions ASMMain/.idea/artifacts/asm_jar.xml

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

7 changes: 7 additions & 0 deletions ASMMain/.idea/encodings.xml

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

13 changes: 13 additions & 0 deletions ASMMain/.idea/misc.xml

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

124 changes: 124 additions & 0 deletions ASMMain/.idea/uiDesigner.xml

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

6 changes: 6 additions & 0 deletions ASMMain/.idea/vcs.xml

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

Binary file added ASMMain/out/artifacts/asm_jar/asm.jar
Binary file not shown.
25 changes: 25 additions & 0 deletions ASMMain/pom.xml
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>
62 changes: 62 additions & 0 deletions ASMMain/src/main/java/tech/tenamen/zemplify/example/Main.java
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;
}
}
Loading

0 comments on commit 1a058f9

Please sign in to comment.