Code Monkey home page Code Monkey logo

iosgyroforcemuhook's Introduction

iOS GYRO for Cemuhook

ALERT

Apparently, this project does not work with newer versions of CEMU and Cemuhook. As I'm not playing WiiU anymore, I do not intend to update this repository. I'd recommend taking a look at https://github.com/hjmmc/WebGyroForCemuhook/releases . It seems to work with the latest verion of the emulator.

Introduction

First, I should note that this is a very quick and dirty solution that I made for my own use. I only created this repository due to the absence of alternatives for the rest of the community. I apologize for the lack of easily configurable files / configuration screens, etc. Anyhow, I believe you'll still find this application very simple to put to work.

This solution enables the use of iPhone's/iPad's and even Android's GYROS in CEMU (with cemuhook) without jailbreak and without installation of any software in the phone. Since HTML5 provides APIs for WebSocket and for gathering GYRO info, it's enough to visit a web page in the phone (hosted in the local network by your computer) to benefit from the phone's GYRO in CEMU.

Requesites

As a hardware POV, your phone and computer should be connected in the same local network.

Sofware side, besides CEMU with cemuhook, you only need to have Node.js installed (with its bin folder included into the path, so that you can use npm and node from the Command Prompt).

Node.js third-party packages

This is a list with the third-party packages that were used in this project. You do not need to worry about that right now, since they are going to be downloaded into the project's folder with npm in the setup instructions.

Setup instructions

Clone this repository into anywhere in your computer (avoid Programs Files due to UAC reasons). Navigate to the folder that contains app.js using the Command Prompt (cd <address>).

Download the required node packages with the following commands (ignore the warnings):

npm install

Finally, run the server with:

npm start

The app.js file implements three servers:

  • An UDP server that communicates with cemuhook (this server listens on the port 26760)
  • An WebSocket server that communicates with the phone (this server listens on the port 1337)
  • An HTTP serve that serves the web page to be accessed by the phone (this server listens on the port 8080)

You can change any ports you want by replacing those values (CTRL+F) in the app.js file with the desired ones. If you change the WebSocket server port, you have to replace it in the static.html file as well.

Now, open the cemuhook.ini file that is inside the CEMU folder, using a text editor. Change the input section and leave it as follows:

[Input]
motionSource = DSU1
motionSourceIsBtnSource = false
serverIP = 127.0.0.1
serverPort = 26760

Note that you may have to change the port, if you have changed it in the app.js file.

Finally, launch a web browser in your iPhone/iPad and navigate to the <computer's_ip_address>:8080 (or :<port> with whatever port you have configured). If you locked the screen / closed the browser or, for any other reason, disconnected from the server, just refresh the page to reconnect (on Chrome, you can refresh by just pulling the page down until the refresh icon appears at the top of the screen).

I strongly adivse you to lock the rotation to portrait mode in the iPhone.

If you are tuning the scale factor in the static.html, I'd recommend opening the page with a private tab. Sice private tabs do not cache, every time you reload you are garanteed to view the most current version.

Enjoy.

Acknowledgements

I'd like to thank FrogTheFrog, since his Steam GYRO for Cemuhook provided the base code for the UDP server and a good understanding of the communication protocol used by Cemuhook.

iosgyroforcemuhook's People

Contributors

denismr avatar

Stargazers

Sebin Suresh avatar Aasif Haque avatar Echoo avatar Jake Downs avatar  avatar  avatar qiaohu  avatar  avatar  avatar Li Li avatar XenHat avatar Grigometh avatar Peter Li avatar Jameson Ricks avatar Jase Su avatar Xuguang Mei avatar hjmmc avatar Dakd Jung avatar 无常 avatar 韩朴宇 avatar Albert Callarisa avatar LiJT avatar Dany avatar Sergey Ipatov avatar  avatar Lucas avatar Trevor Ward avatar  avatar Lukas Senionis avatar

Watchers

James Cloos avatar LiJT avatar

iosgyroforcemuhook's Issues

The iPhone can only do xy rotation, no Z direction and no tilt.

Hi dev,

Could you please have a look into that? my phone is working only in 2D plane, I cannot get any z direction or vertical rotation detection.

Edited:
When I run the Zelda breath of the wild, I cannot shoot arrow using the iphone Gyro to aim, however, I can use the Gyro to aim my magnetic and bomb.

I m testing my iPhone 8 Plus with latest ios 11.2.2, on windows 10 newest update PC.

Thank you very much sir

Server crashes when used with new Cemu (v1.12)

I was trying to use the app with the new Cemu (I tested with v1.12, but this issue probably exists before this version), but the server crashed when I opened Cemu. Here's the error printout:

internal/buffer.js:35
    throw new ERR_OUT_OF_RANGE('value', `>= ${min} and <= ${max}`, value);
    ^

RangeError [ERR_OUT_OF_RANGE]: The value of "value" is out of range. It must be >= 0 and <= 4294967295. Received 3312645462408298
    at checkInt (internal/buffer.js:35:11)
    at writeU_Int32LE (internal/buffer.js:515:3)
    at Buffer.writeUInt32LE (internal/buffer.js:528:10)
    at BeginPacket (D:\Program Files\Games\Cemu\iOSGyroForCemuhook\app.js:51:8)
    at SendPacket (D:\Program Files\Games\Cemu\iOSGyroForCemuhook\app.js:63:15)
    at Socket.server.on (D:\Program Files\Games\Cemu\iOSGyroForCemuhook\app.js:132:7)
    at Socket.emit (events.js:182:13)
    at UDP.onMessage [as onmessage] (dgram.js:670:8)
npm ERR! code ELIFECYCLE
npm ERR! errno 1
npm ERR! [email protected] start: `node app.js`
npm ERR! Exit status 1
npm ERR!
npm ERR! Failed at the [email protected] start script.
npm ERR! This is probably not a problem with npm. There is likely additional logging output above.

Does anybody know what's going wrong? Thanks!

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.