Code Monkey home page Code Monkey logo

geckon's Introduction

geckon

A simple build framework for creating ASM Gecko codes in Nim.

Note: geckon is still in development. The APIs for creating codes are subject to change.

Usage

Please see the melee folder for examples of real Gecko codes written for Super Smash Bros. Melee.

Simple Example

import geckon

defineCodes:
    createCode "My New Code Name":
        authors "Bob"
        description "Does cool things"

        patchWrite32Bits "802724A4":
            nop # replaces the single code line at 802724A4 with 'nop'
        
        patchInsertAsm "802724A8":
            # branch to the address 80380580
            lis r12, {0x80380580} @h
            ori r12, r12, {0x80380580} @l
            mtctr r12
            bctrl
            # or you can call branchLink() from geckon/common.nim:
            %branchLink($0x80380580)

build:
    # can specify as many codes as you want
    addCodes Codes
    # by default, all generated .asm and .o files are kept in a folder called 'generated'
    # can specify `keepObjFiles = false` to remove all .o files and keep only .asm files
    output:
        writeCodesToFile "./codes.txt"

Running the script above produces the following gecko code in a file called codes.txt:

$My New Code Name [Bob]
*Does cool things
042724A4 60000000
C22724A8 00000005
3D808038 618C0580
7D8903A6 4E800421
3D808038 618C0580
7D8903A6 4E800421
60000000 00000000

It also generates the following ASM code for reference:

# 802724A4
nop
# 802724A8
lis r12, 2151155072 @h
ori r12, r12, 2151155072 @l
mtctr r12
bctrl
lis r12, 2151155072 @h
ori r12, r12, 2151155072 @l
mtctr r12
bctrl

License

MIT

geckon's People

Contributors

shaigem avatar

Stargazers

 avatar

Watchers

 avatar

geckon's Issues

Add an option to keep generated ASM files

ASM files are temporarily generated when assembling Gecko codes. They are deleted when the build process has finished.

Provide a option to keep generated ASM files as it is useful for debugging purposes.

Allow code types to be annotated

Outputting code types can have an annotation/description at the beginning of the code line.

For example:

defineCodes:
    createCode "Cool code":
        authors "???"
        description "My cool code"

        patchInsertAsm "80089284":
            description "Does stuff"
            nop

        patchInsertAsm "80089288":
            description "Does MORE stuff"
            nop

Output gecko code:

$Cool code [???]
*My cool code
04089284 60000000 # Does stuff
04089288 60000000 # Does MORE stuff

Provide a way to import a folder of codes in a build script

Currently, you have to import each code individually as seen here:

# codes/melee/buildmelee.nim
import geckon, melee / [fighters/hands/chfixlaser, random/randdmgmulti], melee/random/randangles

build:
    importAll randdmgmulti
    importAll chfixlaser
    importall randangles
# truncated...

Creating codes using outside files

  1. Allow ASM file contents to be included
  2. Write a gecko codes parser

Allow ASM file contents to be included

Would be nice to be able to just include an ASM file and it would load in its ASM contents.

Example

defineCodes:
    createCode "My New Code Name":
        authors "Bob"
        description "Does cool things"

        patchWrite32Bits "802724A4":
            %includeFile "singlepatch.asm"
        
        patchInsertAsm "802724A8":
            %includeFile "coolcode.asm"
            li r3, 0
            # can add more code...

Write a gecko codes parser

Would allow for creating codes based on a text file or binary file containing compiled gecko codes

Limit the prefix of generated files to just letters

Generated files take on the following format: [filename]_[codename]_[targetAddress]

For a file named leech.nim with:

    createCode "Leech Mode - Heal on Every Hit":
        patchInsertAsm "8006d43c":

The file name would be: leech_lm-hoeh_8006D43C.

Notice how it includes the - character. We want it to include ONLY letters from a to z and no special characters.

Add the ability to format generated ASM files to be compatible with JLaferri/gecko tools

Would be nice to be able to make our generated ASM files compatible with other gecko build tools such as the one from Jlaferri/gecko.

All it needs is a header comment such as this one:

################################################################################
# Address: 80155fe4
# Codetype: Auto
# Annotation: Skip CH Entry Cutscene
################################################################################

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.