papermario/tools/splat/util/compiler.py
Ethan Roseman 29c3ffa2e0
Misc decomp 3: Oh baby a triple (#882)
* clean

* git subrepo pull --force tools/splat

subrepo:
  subdir:   "tools/splat"
  merged:   "901241040d"
upstream:
  origin:   "https://github.com/ethteck/splat.git"
  branch:   "master"
  commit:   "901241040d"
git-subrepo:
  version:  "0.4.5"
  origin:   "https://github.com/ingydotnet/git-subrepo"
  commit:   "aa416e4"

* splat update

* more matches after nop hack

* git subrepo pull --force tools/splat

subrepo:
  subdir:   "tools/splat"
  merged:   "715ee0ad55"
upstream:
  origin:   "https://github.com/ethteck/splat.git"
  branch:   "master"
  commit:   "715ee0ad55"
git-subrepo:
  version:  "0.4.5"
  origin:   "https://github.com/ingydotnet/git-subrepo"
  commit:   "aa416e4"

* Renames, match boot_idle

* one mo

* wips

* fish func

Co-authored-by: @JaThePlayer

* sushie dun

* warnings

* clean

* match a nok func

* nok_02 stuff

* nok_04 party image

* func_802BD5D8_3174F8

* LoadPartyImage & stuff

* warnings
2022-12-11 16:43:29 +09:00

41 lines
918 B
Python

from dataclasses import dataclass
@dataclass
class Compiler:
name: str
asm_function_macro: str = "glabel"
asm_jtbl_label_macro: str = "glabel"
asm_data_macro: str = "glabel"
asm_end_label: str = ""
c_newline: str = "\n"
asm_inc_header: str = ""
include_macro_inc: bool = True
GCC = Compiler(
"GCC",
asm_inc_header=".set noat /* allow manual use of $at */\n.set noreorder /* don't insert nops after branches */\n\n",
)
SN64 = Compiler(
"SN64",
asm_function_macro=".globl",
asm_jtbl_label_macro=".globl",
asm_data_macro=".globl",
asm_end_label=".end",
c_newline="\r\n",
include_macro_inc=False,
)
IDO = Compiler("IDO")
compiler_for_name = {"GCC": GCC, "SN64": SN64, "IDO": IDO}
def for_name(name: str) -> Compiler:
name = name.upper()
if name in compiler_for_name:
return compiler_for_name[name]
return Compiler(name)