init (v0.1.0a1)

- Implemented `build`, `make_xml` functions
- Added symbols.py and ldscript
This commit is contained in:
sup39 2023-07-14 21:14:54 +09:00
commit ec8f0251b4
No known key found for this signature in database
GPG key ID: 14D2E0D21140D260
15 changed files with 312917 additions and 0 deletions

4
.gitignore vendored Normal file
View file

@ -0,0 +1,4 @@
/dist
*.egg-info/
__pycache__/
.venv/

4
CHANGELOG.md Normal file
View file

@ -0,0 +1,4 @@
# Changelog
## v0.1.0a1
- Implemented `build`, `make_xml` functions
- Added symbols.py and ldscript

21
LICENSE Normal file
View file

@ -0,0 +1,21 @@
MIT License
Copyright (c) 2023 sup39
Permission is hereby granted, free of charge, to any person obtaining a copy
of this software and associated documentation files (the "Software"), to deal
in the Software without restriction, including without limitation the rights
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
copies of the Software, and to permit persons to whom the Software is
furnished to do so, subject to the following conditions:
The above copyright notice and this permission notice shall be included in all
copies or substantial portions of the Software.
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
SOFTWARE.

1
MANIFEST.in Normal file
View file

@ -0,0 +1 @@
include src/supSMSGecko/ldscript/*

16
README.md Normal file
View file

@ -0,0 +1,16 @@
# supGecko
A helper library to write Gecko code
## Installation
```
pip install supGecko
```
## Usage
```python
from supGecko import Gecko
g = Gecko()
# TODO: usage of the Gecko class
print(g.dump_txt())
```

3
pyproject.toml Normal file
View file

@ -0,0 +1,3 @@
[build-system]
requires = ["setuptools>=42"]
build-backend = "setuptools.build_meta"

24
setup.cfg Normal file
View file

@ -0,0 +1,24 @@
[metadata]
name = supSMSGecko
version = 0.1.0a1
author = sup39
author_email = sms@sup39.dev
description = A helper library to write Gecko code for Super Mario Sunshine
long_description = file: README.md
long_description_content_type = text/markdown
url = https://github.com/sup39/supSMSGecko
license = MIT
project_urls =
Bug Tracker = https://github.com/sup39/supSMSGecko/issues
classifiers =
Programming Language :: Python :: 3
License :: OSI Approved :: MIT License
[options]
packages = find:
python_requires = >=3.8
install_requires =
supGecko >=0.1.0a4, <0.2.0
[options.packages.find]
where = src

View file

@ -0,0 +1,6 @@
# SPDX-License-Identifier: MIT
# Copyright (c) 2023 sup39
from .lib import VERSIONS, build, make_xml
from .symbols import symbols # TODO
from .consts import *

17
src/supSMSGecko/consts.py Normal file
View file

@ -0,0 +1,17 @@
# SPDX-License-Identifier: MIT
# Copyright (c) 2023 sup39
class Button():
START = 0x1000
S = 0x1000
Y = 0x0800
X = 0x0400
B = 0x0200
A = 0x0100
L = 0x0040
R = 0x0020
Z = 0x0010
DU = 0x0008
DD = 0x0004
DR = 0x0002
DL = 0x0001

File diff suppressed because it is too large Load diff

File diff suppressed because it is too large Load diff

File diff suppressed because it is too large Load diff

File diff suppressed because it is too large Load diff

47
src/supSMSGecko/lib.py Normal file
View file

@ -0,0 +1,47 @@
# SPDX-License-Identifier: MIT
# Copyright (c) 2023 sup39
from supGecko import Gecko
import os
import re
VERSIONS = ['GMSJ01', 'GMSE01', 'GMSP01', 'GMSJ0A']
__dirname__ = os.path.dirname(__file__)
def build(main, version):
g = Gecko(compile_flags={
'ld_flags': ['-T', f'{__dirname__}/ldscript/{version}.ld'],
})
main(g, version)
return g
def make_xml(
main, versions=VERSIONS,
info_xml='info.xml', out_xml='out.xml',
indent=4, tag='code',
):
if type(indent) == int: indent = ' '*indent
with open(out_xml, 'w') as fw:
def write_sources(indent_src):
for ver in versions:
print(f'{indent_src}<source version="{ver}">', file=fw)
print(build(main, ver).dump_txt(indent_src+indent), file=fw)
print(f'{indent_src}</source>', file=fw)
if info_xml is not None and os.path.isfile(info_xml):
found_tag = False
with open(info_xml) as f:
for line in f:
m = re.search(r'^(\s*)</(\S+)\s*>', line)
if m is not None:
m_tag = m.group(2)
if m_tag == tag:
indent_code = m.group(1)
write_sources(indent_code+indent)
found_tag = True
print(line, end='', file=fw)
if not found_tag:
raise Exception(f'Tag "{tag}" not found')
else:
print(f'<{tag}>', sep='', file=fw)
write_sources(indent)
print(f'</{tag}>', sep='', file=fw)

134739
src/supSMSGecko/symbols.py Normal file

File diff suppressed because it is too large Load diff