mirror of
https://github.com/pmret/papermario.git
synced 2024-11-08 20:12:30 +01:00
6c606383e8
* nok_04 ok * thread done * push block doc * nok done * almost done pra * pra done * cleanup pra_31 mtx names * git subrepo pull --force tools/splat subrepo: subdir: "tools/splat" merged: "3bbc02af68" upstream: origin: "https://github.com/ethteck/splat.git" branch: "master" commit: "3bbc02af68" git-subrepo: version: "0.4.5" origin: "???" commit: "???" --------- Co-authored-by: HailSanta <Hail2Santa@gmail.com>
20 lines
374 B
Python
20 lines
374 B
Python
from math import ceil
|
|
|
|
from util import options
|
|
|
|
|
|
# RRRRRGGG GGBBBBBA
|
|
def unpack_color(data):
|
|
s = int.from_bytes(data[0:2], byteorder=options.opts.endianness)
|
|
|
|
r = (s >> 11) & 0x1F
|
|
g = (s >> 6) & 0x1F
|
|
b = (s >> 1) & 0x1F
|
|
a = (s & 1) * 0xFF
|
|
|
|
r = ceil(0xFF * (r / 31))
|
|
g = ceil(0xFF * (g / 31))
|
|
b = ceil(0xFF * (b / 31))
|
|
|
|
return r, g, b, a
|