Skip to content

Commit

Permalink
38 pre
Browse files Browse the repository at this point in the history
  • Loading branch information
jrbudda committed Mar 9, 2017
1 parent eae0d76 commit 00bcb6f
Show file tree
Hide file tree
Showing 9 changed files with 349 additions and 36 deletions.
2 changes: 1 addition & 1 deletion minecriftversion.py
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@
of_json_name = "1.7.10_HD_U_D1"
of_file_md5 = "57c724fe8335c82aef8d54c101043e60"
minecrift_version_num = "1.7.10"
minecrift_build = "jrbudda-37r1"
minecrift_build = "jrbudda-38pre"
of_file_extension = ".jar"
mcp_version = "mcp908"
mcp_uses_generics = False
Expand Down
12 changes: 6 additions & 6 deletions patches/net/minecraft/client/Minecraft.java.patch
Original file line number Diff line number Diff line change
Expand Up @@ -1246,7 +1246,7 @@
+ * The minecriftVerString will be automatically updated by the build scripts, do not modify here.
+ * Modify minecriftversion.py in root minecrift dir.
+ */
+ public final String minecriftVerString = "Vivecraft 1.7.10 jrbudda-37r1";
+ public final String minecriftVerString = "Vivecraft 1.7.10 jrbudda-38pre";
+ private boolean trigger;
+ /* end version */
+ /** END MINECRIFT */
Expand Down Expand Up @@ -5157,11 +5157,11 @@
+ this.reinitFramebuffers = true;
+ }
+
+ if (!Display.isActive() && this.fullscreen)
+ {
+ this.toggleFullscreen();
+ this.reinitFramebuffers = true;
+ }
+// if (!Display.isActive() && this.fullscreen)
+// {
+// this.toggleFullscreen();
+// this.reinitFramebuffers = true;
+// }
+
+ if (wasDisplayResized())
+ {
Expand Down
21 changes: 17 additions & 4 deletions patches/net/minecraft/client/gui/GuiChat.java.patch
Original file line number Diff line number Diff line change
@@ -1,6 +1,15 @@
--- a/net/minecraft/client/gui/GuiChat.java
+++ b/net/minecraft/client/gui/GuiChat.java
@@ -118,9 +118,9 @@
@@ -3,6 +3,8 @@
import com.google.common.base.Splitter;
import com.google.common.collect.Lists;
import com.google.common.collect.Sets;
+import com.mtbs3d.minecrift.provider.MCOpenVR;
+
import java.io.File;
import java.net.URI;
import java.net.URISyntaxException;
@@ -118,9 +120,9 @@
this.playerNamesFound = false;
}

Expand All @@ -12,7 +21,7 @@
}
else if (keyCode != 28 && keyCode != 156)
{
@@ -153,8 +153,11 @@
@@ -153,8 +155,15 @@
{
this.submitChatMessage(var3);
}
Expand All @@ -21,12 +30,16 @@
+
+ //VIVE DONT CLOSE ON RETURN
+ // this.mc.displayGuiScreen((GuiScreen)null);
+ this.inputField.setText("");
+ if (MCOpenVR.keyboardShowing) {
+ this.inputField.setText("");
+ } else {
+ this.mc.displayGuiScreen((GuiScreen)null);
+ }
+
}
}

@@ -184,7 +187,7 @@
@@ -184,7 +193,7 @@
var1 = -1;
}

Expand Down
13 changes: 13 additions & 0 deletions patches/net/minecraft/client/main/Main.java.patch
Original file line number Diff line number Diff line change
@@ -0,0 +1,13 @@
--- a/net/minecraft/client/main/Main.java
+++ b/net/minecraft/client/main/Main.java
@@ -77,8 +77,8 @@
ArgumentAcceptingOptionSpec var12 = var1.accepts("uuid").withRequiredArg();
ArgumentAcceptingOptionSpec var13 = var1.accepts("accessToken").withRequiredArg().required();
ArgumentAcceptingOptionSpec var14 = var1.accepts("version").withRequiredArg().required();
- ArgumentAcceptingOptionSpec var15 = var1.accepts("width").withRequiredArg().ofType(Integer.class).defaultsTo(Integer.valueOf(854), new Integer[0]);
- ArgumentAcceptingOptionSpec var16 = var1.accepts("height").withRequiredArg().ofType(Integer.class).defaultsTo(Integer.valueOf(480), new Integer[0]);
+ ArgumentAcceptingOptionSpec var15 = var1.accepts("width").withRequiredArg().ofType(Integer.class).defaultsTo(Integer.valueOf(1280), new Integer[0]);
+ ArgumentAcceptingOptionSpec var16 = var1.accepts("height").withRequiredArg().ofType(Integer.class).defaultsTo(Integer.valueOf(720), new Integer[0]);
ArgumentAcceptingOptionSpec var17 = var1.accepts("userProperties").withRequiredArg().required();
ArgumentAcceptingOptionSpec var18 = var1.accepts("assetIndex").withRequiredArg();
ArgumentAcceptingOptionSpec var19 = var1.accepts("userType").withRequiredArg().defaultsTo("legacy", new String[0]);
9 changes: 9 additions & 0 deletions patches/net/minecraft/network/NetHandlerPlayServer.java.patch
Original file line number Diff line number Diff line change
Expand Up @@ -102,6 +102,15 @@
{
this.setPlayerLocation(this.lastPosX, this.lastPosY, this.lastPosZ, var11, var12);
return;
@@ -468,7 +472,7 @@
double var11 = this.playerEntity.posZ - ((double)var6 + 0.5D);
double var13 = var7 * var7 + var9 * var9 + var11 * var11;

- if (var13 > 36.0D)
+ if (var13 > 262144.0D)
{
return;
}
@@ -1129,20 +1133,20 @@
{
var3 = var2.readItemStackFromBuffer();
Expand Down
28 changes: 15 additions & 13 deletions src/com/mtbs3d/minecrift/provider/MCOpenVR.java
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,7 @@
import com.mtbs3d.minecrift.settings.VRHotkeys;
import com.mtbs3d.minecrift.settings.VRSettings;
import com.mtbs3d.minecrift.utils.KeyboardSimulator;
import com.mtbs3d.minecrift.utils.MCReflection;
import com.sun.jna.Memory;
import com.sun.jna.NativeLibrary;
import com.sun.jna.Pointer;
Expand Down Expand Up @@ -999,7 +1000,7 @@ else if (controllerMouseX == -1.0f)

if (pressedLMB || pressedRMB)
{
{mc.thePlayer.closeScreen();}
// {mc.thePlayer.closeScreen();}
}
}
}
Expand Down Expand Up @@ -1846,6 +1847,16 @@ private static void pollInputEvents()
case EVREventType.EVREventType_VREvent_KeyboardClosed:
//'huzzah'
keyboardShowing = false;
if (mc.currentScreen instanceof GuiChat) {
GuiTextField field = (GuiTextField)MCReflection.getField(MCReflection.chatInputField, mc.currentScreen);
if (field != null) {
String s = field.getText().trim();
if (!s.isEmpty()) {
((GuiChat)mc.currentScreen).submitChatMessage(s);
}
}
mc.displayGuiScreen((GuiScreen)null);
}
break;
case EVREventType.EVREventType_VREvent_KeyboardCharInput:
byte[] inbytes = event.data.getPointer().getByteArray(0, 8);
Expand All @@ -1857,18 +1868,9 @@ private static void pollInputEvents()
if (mc.currentScreen != null) { // experimental, needs testing
try {
for (char ch : str.toCharArray()) {
switch (ch) {
case '\r':
case '\n':
case '\t':
case '\b':
KeyboardSimulator.type(ch);
break;
default:
int[] codes = KeyboardSimulator.getCodes(ch);
mc.currentScreen.keyTypedPublic(ch, codes.length > 0 ? codes[codes.length - 1] : 0);
break;
}
int[] codes = KeyboardSimulator.getLWJGLCodes(ch);
mc.currentScreen.keyTypedPublic(ch, codes.length > 0 ? codes[codes.length - 1] : 0);
break;
}
} catch (Exception e) {
e.printStackTrace();
Expand Down
6 changes: 3 additions & 3 deletions src/com/mtbs3d/minecrift/provider/OpenVRStereoRenderer.java
Original file line number Diff line number Diff line change
Expand Up @@ -42,11 +42,11 @@ public RenderTextureInfo getRenderTextureSizes(float renderScaleFactor)

RenderTextureInfo info = new RenderTextureInfo();
info.HmdNativeResolution.w = rtx.getValue();
info.HmdNativeResolution.h = rtx.getValue();
info.HmdNativeResolution.h = rty.getValue();
info.LeftFovTextureResolution.w = (int) (rtx.getValue());
info.LeftFovTextureResolution.h = (int) (rtx.getValue());
info.LeftFovTextureResolution.h = (int) (rty.getValue());
info.RightFovTextureResolution.w = (int) (rtx.getValue());
info.RightFovTextureResolution.h = (int) (rtx.getValue());
info.RightFovTextureResolution.h = (int) (rty.getValue());
if ( info.LeftFovTextureResolution.w % 2 != 0) info.LeftFovTextureResolution.w++;
if ( info.LeftFovTextureResolution.h % 2 != 0) info.LeftFovTextureResolution.w++;
if ( info.RightFovTextureResolution.w % 2 != 0) info.LeftFovTextureResolution.w++;
Expand Down
130 changes: 121 additions & 9 deletions src/com/mtbs3d/minecrift/utils/KeyboardSimulator.java
Original file line number Diff line number Diff line change
@@ -1,17 +1,24 @@
package com.mtbs3d.minecrift.utils;

import net.minecraft.client.Minecraft;

import org.lwjgl.input.Keyboard;
import org.lwjgl.opengl.Display;

import static java.awt.event.KeyEvent.*;

import java.awt.AWTException;
import java.awt.Robot;


public class KeyboardSimulator {
public static Robot robot;

static{
try {
robot = new Robot();
} catch (AWTException e) {
e.printStackTrace();
}
}

Expand Down Expand Up @@ -143,8 +150,114 @@ public static int[] getCodes(char character) {
case ' ': return codes(VK_SPACE);
case '\b': return codes(VK_BACK_SPACE);
case '\r': return codes(VK_ENTER);
default:
throw new IllegalArgumentException("Cannot type character " + character);
default: return codes();
//default: throw new IllegalArgumentException("Cannot type character " + character);
}
}

public static int[] getLWJGLCodes(char character) {
switch (character) {
case 'a': return codes(Keyboard.KEY_A);
case 'b': return codes(Keyboard.KEY_B);
case 'c': return codes(Keyboard.KEY_C);
case 'd': return codes(Keyboard.KEY_D);
case 'e': return codes(Keyboard.KEY_E);
case 'f': return codes(Keyboard.KEY_F);
case 'g': return codes(Keyboard.KEY_G);
case 'h': return codes(Keyboard.KEY_H);
case 'i': return codes(Keyboard.KEY_I);
case 'j': return codes(Keyboard.KEY_J);
case 'k': return codes(Keyboard.KEY_K);
case 'l': return codes(Keyboard.KEY_L);
case 'm': return codes(Keyboard.KEY_M);
case 'n': return codes(Keyboard.KEY_N);
case 'o': return codes(Keyboard.KEY_O);
case 'p': return codes(Keyboard.KEY_P);
case 'q': return codes(Keyboard.KEY_Q);
case 'r': return codes(Keyboard.KEY_R);
case 's': return codes(Keyboard.KEY_S);
case 't': return codes(Keyboard.KEY_T);
case 'u': return codes(Keyboard.KEY_U);
case 'v': return codes(Keyboard.KEY_V);
case 'w': return codes(Keyboard.KEY_W);
case 'x': return codes(Keyboard.KEY_X);
case 'y': return codes(Keyboard.KEY_Y);
case 'z': return codes(Keyboard.KEY_Z);
case 'A': return codes(Keyboard.KEY_LSHIFT, Keyboard.KEY_A);
case 'B': return codes(Keyboard.KEY_LSHIFT, Keyboard.KEY_B);
case 'C': return codes(Keyboard.KEY_LSHIFT, Keyboard.KEY_C);
case 'D': return codes(Keyboard.KEY_LSHIFT, Keyboard.KEY_D);
case 'E': return codes(Keyboard.KEY_LSHIFT, Keyboard.KEY_E);
case 'F': return codes(Keyboard.KEY_LSHIFT, Keyboard.KEY_F);
case 'G': return codes(Keyboard.KEY_LSHIFT, Keyboard.KEY_G);
case 'H': return codes(Keyboard.KEY_LSHIFT, Keyboard.KEY_H);
case 'I': return codes(Keyboard.KEY_LSHIFT, Keyboard.KEY_I);
case 'J': return codes(Keyboard.KEY_LSHIFT, Keyboard.KEY_J);
case 'K': return codes(Keyboard.KEY_LSHIFT, Keyboard.KEY_K);
case 'L': return codes(Keyboard.KEY_LSHIFT, Keyboard.KEY_L);
case 'M': return codes(Keyboard.KEY_LSHIFT, Keyboard.KEY_M);
case 'N': return codes(Keyboard.KEY_LSHIFT, Keyboard.KEY_N);
case 'O': return codes(Keyboard.KEY_LSHIFT, Keyboard.KEY_O);
case 'P': return codes(Keyboard.KEY_LSHIFT, Keyboard.KEY_P);
case 'Q': return codes(Keyboard.KEY_LSHIFT, Keyboard.KEY_Q);
case 'R': return codes(Keyboard.KEY_LSHIFT, Keyboard.KEY_R);
case 'S': return codes(Keyboard.KEY_LSHIFT, Keyboard.KEY_S);
case 'T': return codes(Keyboard.KEY_LSHIFT, Keyboard.KEY_T);
case 'U': return codes(Keyboard.KEY_LSHIFT, Keyboard.KEY_U);
case 'V': return codes(Keyboard.KEY_LSHIFT, Keyboard.KEY_V);
case 'W': return codes(Keyboard.KEY_LSHIFT, Keyboard.KEY_W);
case 'X': return codes(Keyboard.KEY_LSHIFT, Keyboard.KEY_X);
case 'Y': return codes(Keyboard.KEY_LSHIFT, Keyboard.KEY_Y);
case 'Z': return codes(Keyboard.KEY_LSHIFT, Keyboard.KEY_Z);
case '`': return codes(Keyboard.KEY_GRAVE);
case '0': return codes(Keyboard.KEY_0);
case '1': return codes(Keyboard.KEY_1);
case '2': return codes(Keyboard.KEY_2);
case '3': return codes(Keyboard.KEY_3);
case '4': return codes(Keyboard.KEY_4);
case '5': return codes(Keyboard.KEY_5);
case '6': return codes(Keyboard.KEY_6);
case '7': return codes(Keyboard.KEY_7);
case '8': return codes(Keyboard.KEY_8);
case '9': return codes(Keyboard.KEY_9);
case '-': return codes(Keyboard.KEY_MINUS);
case '=': return codes(Keyboard.KEY_EQUALS);
case '~': return codes(Keyboard.KEY_LSHIFT, Keyboard.KEY_B);
case '!': return codes(Keyboard.KEY_LSHIFT, Keyboard.KEY_1);
case '@': return codes(Keyboard.KEY_LSHIFT, Keyboard.KEY_2);
case '#': return codes(Keyboard.KEY_LSHIFT, Keyboard.KEY_3);
case '$': return codes(Keyboard.KEY_LSHIFT, Keyboard.KEY_4);
case '%': return codes(Keyboard.KEY_LSHIFT, Keyboard.KEY_5);
case '^': return codes(Keyboard.KEY_LSHIFT, Keyboard.KEY_6);
case '&': return codes(Keyboard.KEY_LSHIFT, Keyboard.KEY_7);
case '*': return codes(Keyboard.KEY_LSHIFT, Keyboard.KEY_8);
case '(': return codes(Keyboard.KEY_LSHIFT, Keyboard.KEY_9);
case ')': return codes(Keyboard.KEY_LSHIFT, Keyboard.KEY_0);
case '_': return codes(Keyboard.KEY_LSHIFT, Keyboard.KEY_MINUS);
case '+': return codes(Keyboard.KEY_LSHIFT, Keyboard.KEY_EQUALS);
case '\t': return codes(Keyboard.KEY_TAB);
case '\n': return codes(Keyboard.KEY_RETURN);
case '[': return codes(Keyboard.KEY_LBRACKET);
case ']': return codes(Keyboard.KEY_RBRACKET);
case '\\': return codes(Keyboard.KEY_BACKSLASH);
case '{': return codes(Keyboard.KEY_LSHIFT, Keyboard.KEY_LBRACKET);
case '}': return codes(Keyboard.KEY_LSHIFT, Keyboard.KEY_RBRACKET);
case '|': return codes(Keyboard.KEY_LSHIFT, Keyboard.KEY_BACKSLASH);
case ';': return codes(Keyboard.KEY_SEMICOLON);
case ':': return codes(Keyboard.KEY_LSHIFT, Keyboard.KEY_SEMICOLON);
case '\'': return codes(Keyboard.KEY_APOSTROPHE);
case '"': return codes(Keyboard.KEY_LSHIFT, Keyboard.KEY_APOSTROPHE);
case ',': return codes(Keyboard.KEY_COMMA);
case '<': return codes(Keyboard.KEY_LSHIFT, Keyboard.KEY_COMMA);
case '.': return codes(Keyboard.KEY_PERIOD);
case '>': return codes(Keyboard.KEY_LSHIFT, Keyboard.KEY_PERIOD);
case '/': return codes(Keyboard.KEY_SLASH);
case '?': return codes(Keyboard.KEY_LSHIFT, Keyboard.KEY_SLASH);
case ' ': return codes(Keyboard.KEY_SPACE);
case '\b': return codes(Keyboard.KEY_BACK);
case '\r': return codes(Keyboard.KEY_RETURN);
default: return codes();
//default: throw new IllegalArgumentException("Cannot type character " + character);
}
}

Expand All @@ -154,13 +267,12 @@ private static int[] codes(int... keyCodes) {

private static void doType(int[] keyCodes, int offset, int length) {
try {

if (length == 0) {
return;
}
robot.keyPress(keyCodes[offset]);
doType(keyCodes, offset + 1, length - 1);
robot.keyRelease(keyCodes[offset]);
if (length == 0) {
return;
}
robot.keyPress(keyCodes[offset]);
doType(keyCodes, offset + 1, length - 1);
robot.keyRelease(keyCodes[offset]);
} catch (Exception e) {
System.out.println("Cannot type keycode: " + keyCodes[offset]);
}
Expand Down
Loading

0 comments on commit 00bcb6f

Please sign in to comment.