Coder Social home page Coder Social logo

cgrr-gamecube's Introduction

cgrr-gamecube

gci.py provides functions to read GameCube GCI files.

Usage

Reading a GCI file:

>>> import gci
>>> gci.read_gci("test.gci")
{'m_gci_header': {'AnimSpeed': [<AnimSpeed.ANIM_NO_ICON: 0>,
                                <AnimSpeed.ANIM_NO_ICON: 0>,
                                <AnimSpeed.ANIM_12_FRAMES: 3>,
                                <AnimSpeed.ANIM_12_FRAMES: 3>,
                                <AnimSpeed.ANIM_12_FRAMES: 3>,
                                <AnimSpeed.ANIM_12_FRAMES: 3>,
                                <AnimSpeed.ANIM_12_FRAMES: 3>,
                                <AnimSpeed.ANIM_12_FRAMES: 3>],
                  'BIFlags': <BIFlags.BANNER_CI8: 1>,
                  'BlockCount': 3,
                  'CommentsAddr': 0,
                  'CopyCounter': 1,
                  'Filename': 'TestFile',
                  'FirstBlock': 42,
                  'Gamecode': 'TEST',
                  'IconFmt': [<IconFmt.ICON_NONE: 0>,
                              <IconFmt.ICON_NONE: 0>,
                              <IconFmt.ICON_CI8_SHARED: 1>,
                              <IconFmt.ICON_NONE: 0>,
                              <IconFmt.ICON_NONE: 0>,
                              <IconFmt.ICON_CI8_SHARED: 1>,
                              <IconFmt.ICON_NONE: 0>,
                              <IconFmt.ICON_CI8_SHARED: 1>],
                  'ImageOffset': 64,
                  'Makercode': '01',
                  'ModTime': datetime.datetime(2011, 11, 12, 18, 5, 10),
                  'Permissions': {<Permissions.PERM_NO_COPY: 4>},
                  'Unused1': 255,
                  'Unused2': 65535}
 'm_save_data': [b"This is a test GCI file. The data here should be a..."]

Editing a gci file:

import gci
g = gci.read_gci("test.gci")
g['m_gci_header']['GameCode'] = "EDIT"
g['m_gci_header']['Filename'] = "EditedFileName"
data = gci.write_gci(g)
with open("edited.gci") as out:
    out.write(data)

More:

>>> g = gci.read_gci("Super Mario Sunshine.gci")

>>> gci.get_region(g)
<Region.REGION_US: 'E'>

>>>gci.get_game_name(g)
'Super Mario Sunshine'

>>>gci.get_file_info(g)
'11/2 Save Data'

>>>banner = gci.get_banner(g)
>>>banner
<PIL.Image.Image image mode=RGBA size=96x32 at 0xB71A308C>

>>>banner.show()
>>>banner.save('Super Mario Sunshine Banner.gif')

Requirements

You can install cgrr and pillow with pip install -r requirements.txt.

License

This module is available under the GPL v3 or later. See the file COPYING for details.

Build Status Code Health

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.