Code Monkey home page Code Monkey logo

gctgenerator's Introduction

GCT Generator

GitHub license CD Pipeline

This repository contains the code behind the Super Mario Sunshine Cheatfile Generator at https://gct.zint.ch/


Features


Contributing

Updating Practice Codes

The codes are stored in the Codes.xml file. If you want to add or change codes edit the XML file. Note that GMSJ0A refers to the NTSC-J 1.1 release of Super Mario Sunshine. (It's not actually called version A but that's what we've been calling it for years due to a misconception on what the A on the back of the box means).

When adding new codes keep in mind that the English title/description are mandatory.

Codes with configuration

Codes with configuration are usually defined as vue components, which is defined in site/.vuepress/components/codes/. When creating/updating those codes, in addition to editing the Codes.xml file, you may also need to check the following files:

Reserved Memory

Some codes store some states in the games memory starting from address 0x817F0000 (up to 0x817FFFFF). To avoid collisions use a memory range in the unallocated ranges.

Status Start End Description
0x0 0x7 Level Select: Stage Data
0x8 0x13 DPad Functions: Stored Position (Mario)
0x14 0x15 DPad Functions: Stored Angle (Mario)
0x16 0x1B DPad Functions: Stored Position (Camera)
0x20 0x23 Coin Count Savestate: Coin Count
0x24 0x26 Pattern Selector: Selected Pattern Numbers
0x27 0x27 Pattern Selector: Cursor Position
0x28 0x29 Instant Level Select: Last Selected Area ID
0x2A 0x2A Instant Level Select: Last Selected Episode Number
0x2B 0x2B Instant Level Select: Area Lock Flag
0x2C 0x2C Red Coin Savestate: Red Coin state
0x2D 0x2D Red Coin Savestate: Red Coin Count
0x2E 0x2F Not Allocated
0x30 0x33 QF Time Savestate: Stored QF Time
0x34 0x3B In-Game Time Savestate: Stored Elapsed Time
0x3C 0x3F Open World Shine Get: Last Touched Shine Game QF
0x40 0x4F Mario Savestate: Stored State (0x7C-0x8B)
0x50 0x57 Mario Savestate: Stored Flag (0x118-0x123)
0x58 0x5B Mario Savestate: Stored Horizontal Speed
0x5C 0x5F Mario Savestate: Stored Vertical Speed
0x60 0x63 Mario Savestate: Stored Last Grab Target
0x64 0x67 Mario Savestate: Stored Water Amount
0x68 0x93 Not Allocated
0x94 0xA3 QF Timer: Coordinates of the Text box (LTRB)
0xA4 0xB0 QF Timer: Timer Format String
0xB0 0xB1 QF Timer: (Unused)
0xB2 0xB2 QF Timer: Stop at QFT Offset
0xB3 0xB3 QF Timer: Restart Flag
0xB4 0xB7 QF Timer: Cumulative time of previous areas since last reset (QFT Offset)
0xB8 0xBB QF Timer: Time to display if timer freeze > 0
0xBC 0xBF QF Timer: Duration of timer freeze (in frames)
0xC0 0xFF Buffer (QF Timer)
0x100 0x100 Ingame Timer: Reset Stopwatch Flag
0x101 0x101 Ingame Timer: Disable Custom IG Timer Flag
0x102 0x10B Ingame Timer: Stopwatch Backup
0x10C 0x10C Ingame Timer: Stop Stopwatch Flag
0x10D 0x10F Buffer (Ingame Timer)
0x110 0x11F QF Timer: Text Config
0x120 0x123 QF Timer: Background Config
0x124 0x133 Streak Tracker: Text Config
0x134 0x237 Not Allocated
0x238 0x347 General Function (drawText)
0x348 0x39B Buffer (QF Timer)
0x39C 0x3AF QF Section Timer: Background Config
0x3B0 0x3BF QF Section Timer: Text Config
0x3C0 0x3C8 QF Section Timer: Format String
0x3C9 0x3C9 QF Section Timer: (Unused)
0x3CA 0x3CB QF Section Timer: Section Count
0x3CC 0x3CF QF Section Timer: Last Freezed Time
0x3D0 0x40F QF Section Timer: Section Time Array
0x410 0x41F Pattern Selector: Background Config
0x424 0x433 Pattern Selector: Text Config
0x434 0x440 Pattern Selector: Format String
0x441 0x475 Pattern Selector: Pattern Data
0x476 0x477 Attempt Counter: Previous Area
0x478 0x478 Attempt Counter: Display Timer
0x479 0x479 Attempt Counter: Display Duration
0x47A 0x47F Attempt Counter: Format String
0x480 0x48F Attempt Counter: Text Config
0x490 0x4A3 Attempt Counter: Background Config
0x4A4 0x4A5 Attempt Counter: Success Count
0x4A6 0x4A7 Attempt Counter: Attempt Count
0x4A8 0x4A8 Attempt Counter: Got Shine Flag
0x4A9 0x4AF Buffer (Attempt Counter)
0x4B0 0x4BF Not Allocated
0x4C0 0x4C2 Buffer (Controller Input Display)
0x4C3 0x4C3 Controller Input Display: Line Width
0x4C4 0x4C7 Controller Input Display: Scale
0x4C8 0x4CB Controller Input Display: (X, Y) Coordinate
0x4CC 0x4CF Controller Input Display: Background Color
0x4D0 0x53F Controller Input Display: Components Config
0x540 0x17F8 Not Allocated
0x17F8 0xD800 GCI Loader Codes (0x81780000 - 8)*
0xD800 0xFFFF GCI Loader

* Additional gecko codes from the memory card are loaded into this space by the GCI loader. The loader is currently maintained on the fork at https://github.com/BitPatty/sms-gci-gecko-loader, original (archived) repo: https://github.com/sup39/SMS-GCI-Loader.

Adding translations

  1. Create a new file <lang>.json in site/.vuepress/i18n, where <lang> is the language code you want to add. Copy the contents of en-US.json into your file and translate each entry in the JSON file.
  2. Create a new folder with your language code in site (such as site/de for German). Create a new markdown file for each existing page (guide.md, index.md, ios58.md, ...) and translate its contents from the English version.
  3. Create a new entry in site/.vuepress/i18n/locales.json with the site metadata and navigation items for your language.
  4. Add your locale to the translations in site/.vuepress/i18n/localeHelper.js.
  5. Open Codes.xml and add a translation for each code (<title> and <description>).

Updating Guides

You can find the guides in the site folder. Simply edit the corresponding markdown file (.md).

Note that in the code reference files everything following the <!-- injectionpoint --> tag will be removed during the next build.

Site Development

You can either use dev containers or your own setup to develop new features.

Using Dev-Containers

If you have access to codespaces simply open the repository in codespaces. Else you can set it up locally as follows:

  1. Install Docker and docker-compose.
  2. Open the project in VSCode
  3. Click the Reopen in Container button or run the command with the same name.

Using your own environment

Due to formatting rules you should use VSCode for development with the following features/extensions:

  • NodeJS 16.x (LTS)
  • npm 8.x
  • octref.vetur
  • esbenp.prettier-vscode

Development commands

# Install dependencies
npm i

# Inject codes from the Codes.xml file
npm run codes:inject

# Run project in watch mode
# This will serve the page in development mode on http://localhost:8080
npm run dev

# Remove injected codes
npm run codes:clean

# Build project for production
npm run build

# Serve the production build
npm run serve

The XML codes will be written automatically to the json file and code reference during the following actions:

  • Starting the development server with npm run dev
  • Building the site with npm run build

If you want to inject the codes at any given point you can use npm run codes:inject.

!!! Note that if npm was used, npm run codes:clean is ran automatically as a pre-commit hook, removing all injected codes and staging ALL changes. If you want to commit changes without cleaning codes first you have to commit through git commit --no-verify.

Build and preview the site (Docker)

The project root provides a docker-compose file, which creates a clean build (with the same configuration as the production build) and spins up a minimal Apache server on your local, serving the resulting build on port 8080.

# Build and serve the site on http://localhost:8080
# Press CTRL+C to stop the container
docker-compose up --build

gctgenerator's People

Contributors

bitpatty avatar botpatty avatar dependabot-preview[bot] avatar dependabot[bot] avatar imgbotapp avatar milksr avatar qberoot avatar renovate-bot avatar sup39 avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar  avatar

gctgenerator's Issues

[FEAT] Pattern Selector suggestions

Is your request related to a problem? Please describe

  1. The pattern selector is always on screen even though it's only used for two levels.
  2. It's confusing to have the button to change patterns be L while the cursor says B

Describe the solution you'd like

  1. Hide the entire text when in a level that doesn't support Pattern Selector and/or Only display pattern selector on the pause screen; hiding it while unpaused
  2. Change the cursor to โ˜… instead of โ’ท

Describe alternatives you've considered

No response

Additional context

No response

Fast Piantissimo in Fast IWs

Feature Request
Requesting that a code be made to force fastest Piantissimo on all versions.
Both standalone and integrated into the Stage List Loader, used in Fast IW presets.
Please also document the time difference of and criteria for unlocking the Piantissimo patterns.

Usage
In my use case, with the Fast IW IGT memory autosplitter script, this would remove the need to mess about with memory cards and have to menu to Save and Continue in all Fast IWs including Piantissimo. This would make it very easy to run Fast IWs on emulator, by running the game with Stage Loader and QFT cheat codes (make a save-state for each world for convenience), and having the autosplitter automatically follow the stages and resets.

Further Development
I'd recommend standardising QFT to conform to IL timing and encouraging this practice method with cumulative-IGT leaderboards going forward. On console, Fast IWs still work but require manually adding up the IL times to get IWs. I'd recommend integrating all this into a Fast IW romhack down the line, to save having to make a save-state with the correct set of cheat codes for each IW.

[FEAT] Text can sometimes be hard to read

Is your request related to a problem? Please describe

White text on a light background is difficult to read. This happens with all the info displays and Pattern Selector.

Describe the solution you'd like

Draw a translucent black box behind all text by default, like there already is for QFT.

Describe alternatives you've considered

No response

Additional context

No response

[BUG]: Offset QFT background with Speed display or P/A/S display

Describe the bug

If Speed display or Position/angle/speed display is enabled, Quarterframe Timer's background box appears above and slightly left of the timer. If Customized display is enabled instead, the background box is in the right place.

Originally found on PAL Wii Nintendont with Speed display, replicated on PAL Dolphin 5.0-6022 with both displays

Since Customized display is functionally equivalent to both other display codes, and shorter than them, we might just want to simplify its options and delete the old display codes

Enabled Codes

  • Quarterframe Timer
  • Speed display or Position/angle/speed display

To Reproduce

Enter any level to make QFT appear, and the background will be offset.

Loader

None

Loader Version

No response

Game Version

PAL (Europe)

Wii Region

None

Game Source

None

Nintendont Source

None

drawText parameters as struct

Is your request related to a problem? Please describe

drawText currently takes 5 "visual" parameters, then a format string, then varargs to be inserted into the text. Per the PowerPC ABI, only registers r3-r10 can be used for non-float function arguments, and with the fixed arguments taking up r3-r8, that only leaves r9 and r10 for varargs. QFT only needs 3 varargs (minutes, seconds and milliseconds) but already has to set up a stack frame for the last one.

Describe the solution you'd like

Since the first 5 parameters are configured on the site then constant in the downloaded file, I think it would make sense to store them in RAM and have the caller simply pass a pointer to its settings struct. It would also make it easy to tweak those settings live in a RAM editor or an eventual built-in settings screen. The format string is much more related to the varargs so it would make sense to keep it as a separate argument imo

Describe alternatives you've considered

No response

Additional context

No response

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.