Giter Site home page Giter Site logo

marcussacana / ps4-openorbis-mono Goto Github PK

View Code? Open in Web Editor NEW
11.0 2.0 2.0 75.75 MB

A Sample Mono Entrypoint for PS4 homebrews

License: The Unlicense

Makefile 0.11% C 0.92% C# 98.85% Batchfile 0.11% PowerShell 0.02%
csharp homebrew mono playstation playstation-4 sdk-example sdl2 video-game

ps4-openorbis-mono's Introduction

PS4-OpenOrbis-Mono

A Sample Mono Entrypoint for PS4 homebrews with OrbisGL working

If you want, you can use the pre-built binaries and just rebuild the "main" C# project,
and by replacing the main.exe inside the pkg and/or adding any new assemblies, in the PKG, you will be able to create your HB even without deal with the OpenOrbis SDK.

How to Clone

git clone https://github.com/marcussacana/OrbisGL
git submodule init
git submodule update --init --recursive

How to build (Linux)

  • Clone the repo
  • Install the OpenOrbis SDK
  • Install the Mono SDK
  • Run make

How to build (Windows)

  • Clone the repo
  • Install and Build the OpenOrbis SDK
  • Install the Visual Studio
  • Install LLVM choco install llvm
  • Run the Developer Command Prompt for VS
  • Open this repo directory in the cmd
  • Run build-windows.bat

How to debug

  • Build the homebrew with make debug or build-windows.bat debug
  • Install and Start the homebrew (it will freeze, that's ok)
  • With Monodevelop or Jetbrains, connect the remote debugging at 2222

Notes

  • The Mono runtime needs to be in a jailbroken process to be able to use the PS4 JIT features.
  • A Homebrew template for Windows is available, Download Here

How it works

The PS4 default mono runtime allways try load the modules from sprx files, in this example, at /PS4-OpenOrbis-Mono/trampoline.c a hook in the mono runtime is installed in the function that try open the sprx assembly, and instead, load the .dll or .exe assembly file and call the mono runtime export mono_image_open_from_data_with_name, because it was made for load assembly direct from memory, that function don't expect a sprx file, but a common assembly file instead, allowing we load our mono libraries.

Since it depends of hooks, we need or ship the mono runtime in the pkg with a known offset, or instead detect the firmware version and find all possible offsets for all FWs. While the first method is easy and safest and works with different FWs, you will share a sony binary, and that can be a license issue.
In the second method you don't need to ship the PS4 mono runtime library, but instead you will need to add offests for each FWs and be sure, when a new JB came you should need update the offsets as well. This second method can works with different FWs as well, but that if you make the code detect the FW, and use the correct hook offset.
The good news about the second method is how is just a single hook, then you just need found one offset, and the given function is the only one that references the string %s.sprx, this make the job to find the correct function easy.
image

A third way and correct way, should be create a tool to pack the assemblies as fake sprx, I didn't tried that.
Really, I should try do that before create a hook, lol.

Tested in FW 6.72 and 9.00 only

Special Thanks:

Lighting Mods, AlAzif, Bucanero, Flatz, sleirsgoevy, OSM-Made and of course, the OpenOrbis team.

ps4-openorbis-mono's People

Contributors

marcussacana avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar

Forkers

kmeps4 devcrono

ps4-openorbis-mono's Issues

Fix SDL2 Methods

The SDL2# used marshaling in the DLLImports, while we are using Internal Calls.
The Internal Calls didn't support marshaling, then we must update the methods to do marshaling manually.

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.