Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Rkg script #23

Open
wants to merge 2 commits into
base: main
Choose a base branch
from
Open

Rkg script #23

wants to merge 2 commits into from

Conversation

AtishaRibeiro
Copy link
Contributor

@AtishaRibeiro AtishaRibeiro commented Jan 14, 2023

#5 Initial commit, the following still needs to happen:

  • actually test the produced rkg in dolphin
  • figure out how to pass metadata to the script

Personally I'm not a fan of getting the metadata through a prompt because then you would have to fill in the id's of the character and vehicle which people don't know by heart.
How will this script be used exactly? If it is used by a discord bot or something then imo it makes more sense to just pass all the metadata as arguments to the script directly.

Comment on lines +9 to +16
assert AButton == 0 or AButton == 1, \
f"A button input has value `{AButton}` at line {csv_line}"

assert BButton == 0 or BButton == 1, \
f"B button input has value `{BButton}` at line {csv_line}"

assert ItemButton == 0 or ItemButton == 1, \
f"Item button input has value `{ItemButton}` at line {csv_line}"
Copy link
Owner

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

"<button> button input on line {csv_line} is out of range! Expected 0 - 1, got `{<button>}`"

Comment on lines +32 to +36
assert -7 <= YDirection <= 7, \
f"Y direction input has value `{YDirection}` at line {csv_line}"

assert -7 <= XDirection <= 7, \
f"X direction input has value `{XDirection}` at line {csv_line}"
Copy link
Owner

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

We (regrettably) shouldn't assume the CSV is 0-centered.

"<direction> direction input has inconsistent centering at line {csv_line}"
"<direction> direction input on line {csv_line} is out of range! Expected {range} - {range + 14}, got `{<direction>}`"

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

In what situation would this not be the case?
How do we know then how to parse the csv if this is not always the case? A parameter that specifies the format?

Copy link
Owner

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

There are still people who use 7-centered.

The most we can do is infer the center by checking unshared boundaries (> 7, < 0). If that fails, we may want to default to whichever number has the highest frequency, since neutral inputs are most likely the more common of the two. Alternatively, we can ask the user via input what center the script is.

Comment on lines +49 to +50
assert 0 <= TrickInput <= 4, \
f"Trick input has value `{TrickInput}` at line {csv_line}"
Copy link
Owner

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

"Trick input on line {csv_line} is out of range! Expected 0 - 4, got `{TrickInput}`"


def get_dummy_data():
"""Generate dummy metadata to put in the header of the rkg file"""
return MetaData(0, 0, 0, True)
Copy link
Owner

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Dummy metadata is invalid - this will generate a ghost with Mario on Standard Kart S.

Comment on lines +167 to +171
if len(inputs) > 0x2774:
print("Too many ghost inputs for a standard RKG file")
else:
# Pad input data until it is of length 0x2774
inputs.extend([0x00] * (0x2774 - len(inputs)))
Copy link
Owner

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Good idea for general use, though you may want to add a boolean for this project since we can rewrite the ghost parsing to extend the size.

@vabold
Copy link
Owner

vabold commented Jan 15, 2023

With regards to metadata, there are two approaches that I think would be good.

If no arguments are passed to the script, we can query with input and send the resulting string into a dict for the ID. Should be simple, we can replace with _ and lowercase it before sending it in.

If there are arguments passed into the script, we assume that the arguments are IDs and use them directly.

On a separate note, due to the Mario/Standard Kart S thing, we may want to check that the character/vehicle combination is valid.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants