papermario/tools/splat/util/symbol.py
Ethan Roseman b7a2673672
Misc decomp and rodata migration (#198)
* misc decomp...2

* re-run disasm

* more shtuff

* rodata stuff

* more rodata stuff

* more rodata migration

* rodata stuff 🐱

* meowp

* git subrepo pull tools/splat

subrepo:
  subdir:   "tools/splat"
  merged:   "199d63489a"
upstream:
  origin:   "https://github.com/ethteck/splat.git"
  branch:   "master"
  commit:   "199d63489a"
git-subrepo:
  version:  "0.4.3"
  origin:   "https://github.com/ingydotnet/git-subrepo"
  commit:   "2f68596"

* git subrepo pull tools/splat

subrepo:
  subdir:   "tools/splat"
  merged:   "b0f5ab40a2"
upstream:
  origin:   "https://github.com/ethteck/splat.git"
  branch:   "master"
  commit:   "b0f5ab40a2"
git-subrepo:
  version:  "0.4.3"
  origin:   "https://github.com/ingydotnet/git-subrepo"
  commit:   "2f68596"

* git subrepo pull tools/splat

subrepo:
  subdir:   "tools/splat"
  merged:   "4e79cc1a4e"
upstream:
  origin:   "https://github.com/ethteck/splat.git"
  branch:   "master"
  commit:   "4e79cc1a4e"
git-subrepo:
  version:  "0.4.3"
  origin:   "https://github.com/ingydotnet/git-subrepo"
  commit:   "2f68596"

* git subrepo pull tools/splat

subrepo:
  subdir:   "tools/splat"
  merged:   "53370e3217"
upstream:
  origin:   "https://github.com/ethteck/splat.git"
  branch:   "master"
  commit:   "53370e3217"
git-subrepo:
  version:  "0.4.3"
  origin:   "https://github.com/ingydotnet/git-subrepo"
  commit:   "2f68596"

* OK

* symbol_addrs script update

* PR comments

* fake gross match
2021-03-07 18:32:24 +00:00

51 lines
1.3 KiB
Python

class Symbol:
@property
def default_name(self):
suffix = f"_{self.vram_start:X}"
if self.in_overlay:
suffix += f"_{self.rom:X}"
if self.type == "func":
prefix = "func"
elif self.type =="jtbl":
prefix = "jtbl"
else:
prefix = "D"
return prefix + suffix
@property
def rom_end(self):
return None if not self.rom else self.rom + self.size
@property
def vram_end(self):
return self.vram_start + self.size
def set_in_overlay(self):
self.in_overlay = True
@property
def name(self):
return self.given_name if self.given_name else self.default_name
def contains_vram(self, offset):
return offset >= self.vram_start and offset < self.vram_end
def contains_rom(self, offset):
return offset >= self.rom and offset < self.rom_end
def __init__(self, vram, given_name=None, rom=None, type="unknown", in_overlay=False, size=4):
self.defined = False
self.referenced = False
self.vram_start = vram
self.rom = rom
self.type = type
self.in_overlay = in_overlay
self.size = size
self.given_name = given_name
self.access_mnemonic = None
self.disasm_str = None