Coder Social home page Coder Social logo

cranked's Introduction

Cranked

About

Seeing the lack of an open source Playdate emulator, this seemed like a good opportunity to be the first to reverse engineer and reimplement the platform. Most of the file formats had already been reverse engineered, but little in the way of actually loading and running games (See Sources for reference materials). Much of the functionality is missing, such as sprites, audio, and graphical effects, and very little is tested thoroughly, but the groundwork is laid and Lua or native programs can be run. See Runtime.cpp and LuaRuntime.cpp for implemented API functions and todo items. Expect many crashes.

Screenshots

From C

From C

From Lua

From Lua

Building

Libraries are all embedded as submodules except for SDL2, which is required for building desktop targets.

Recursively clone the repo with: git clone --recursive https://github.com/TheLogicMaster/Cranked.

After installing dependencies, build from the project directory with the following commands (Only tested on Linux):

cmake -S . -B build
cmake --build build

This should have built the Libretro core and the standalone executable.

Running Roms

Loading either .pdx directories or .pdx.zip archives is supported (Only .pdx.zip for Libretro core). Run the standalone executable with the ROM path as the only command-line argument or load the Libretro core like any other. Most programs will likely crash at the moment and there is little in the way of useful debug output, so debugging from an IDE is best for now.

Todo

  • Sprites
  • Graphical effects
  • Pattern/stencil drawing
  • Polygon, rounded rect drawing
  • Perlin noise
  • Pathfinding
  • Video
  • Bitmap Tables
  • Audio
  • Full font support
  • GIF and WAV writing
  • Respect all graphical context options like clip rect
  • Finish C JSON decoding
  • Finish C Lua API
  • Test building on Windows/Mac
  • Emulated core dumps with disassembly
  • Create a testing framework to compare console output to the official simulator
  • Finish font-ends (Libretro core just crashes at the moment, Desktop has no features, Android only loads a test program)
  • Java library with native libs for Android app consumption
  • Further investigation for native resource ownership and memory management (Plus Lua sprite/bitmap interactions)
  • Scoreboard support
  • Investigate Catalog app (Find internal APIs), see if emulator can play encrypted games with a dumped key or something
  • System UI/software from SDK
  • Investigate pre-2.0.0 binaries to handle uncompressed data
  • Emulator API wrapper to hide all the messy internals, possible C compatible
  • Use namespaces
  • Values checks, since plenty of null/illegal API parameters will cause a native seg-fault
  • SDK version checks for API backwards compatibility
  • GitHub Actions release builds

Internals

  • Unicorn to provide Arm CPU emulation
  • Custom memory allocator to allocate heap memory in a single 32-bit region for easier virtual memory mapping
  • C++ template magic plus libFFI to translate calls between emulated Arm, Lua, and C++ natives, handling type marshaling and virtual memory mapping
  • Auto-generated 64-bit safe equivalent Playdate API and data structures by parsing the official headers
  • Lua objects represented by tables with userdata field and metatables
  • Reference counting for shared Lua resources like images and fonts

Libraries and Resources

Sources

cranked's People

Contributors

thelogicmaster avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar

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.