You've already forked hackerlibultra
mirror of
https://github.com/HackerN64/hackerlibultra.git
synced 2026-01-21 10:37:53 -08:00
Format the Repo (#3)
* set build options * remove COMPARE and MDOERN_* switches * remove tools makefile * AR patching is gone too since we want a fullly decomped version * AR is modern * remove cwd changes * edit my own tool to fix compile errors * compile files generated with my own tool instead of the originals * inline modern_gcc makefile * port mips toolchain detection logic * add util.mk for find-command * remove forced AR order and strip/mdebug removal commands * add -mabi=32 to as flags * formatting changes * add clang format files * formatting changes * make libgultra CI work * install mips gcc too * add format check tools * Add formatting to CI * Add CI (#4) * make libgultra CI work * install mips gcc too * remove make setup --------- Co-authored-by: someone2639 <someone2639@gmail.com> * we don't use clang-tidy * use 120 width for formatting * a * address clang-tidy messing up * test * align consecutive macros and declarations * only align macros for now * SpaceAfterCStyleCast: false * format headers too * remove cast space switch because its false by default * pointers on left * AlignConsecutiveBitFields: true * install clang-format and clang-tidy on gh actions * and clang-tools * show diff in format check tool * make CI work --------- Co-authored-by: someone2639 <someone2639@gmail.com> 🙏
This commit is contained in:
19
.clang-format
Normal file
19
.clang-format
Normal file
@@ -0,0 +1,19 @@
|
||||
IndentWidth: 4
|
||||
Language: Cpp
|
||||
AlignAfterOpenBracket: Align
|
||||
SortIncludes: false
|
||||
ColumnLimit: 120
|
||||
PointerAlignment: Left
|
||||
AllowShortFunctionsOnASingleLine: false
|
||||
AllowShortIfStatementsOnASingleLine: false
|
||||
AlignConsecutiveMacros: true
|
||||
BinPackArguments: true
|
||||
BinPackParameters: true
|
||||
BreakBeforeBraces: Attach
|
||||
BreakBeforeTernaryOperators: true
|
||||
BreakBeforeBinaryOperators: NonAssignment
|
||||
Cpp11BracedListStyle: false
|
||||
IndentCaseLabels: true
|
||||
AlignTrailingComments: true
|
||||
AlignConsecutiveBitFields: true
|
||||
UseTab: Never
|
||||
8
.github/workflows/ci_gcc.yml
vendored
8
.github/workflows/ci_gcc.yml
vendored
@@ -23,7 +23,13 @@ jobs:
|
||||
ref: ${{ github.event.pull_request.head.sha }}
|
||||
|
||||
- name: Install package requirements
|
||||
run: sudo apt-get install -y gcc-mips-linux-gnu binutils-mips-linux-gnu build-essential python3
|
||||
run: sudo apt-get install -y clang-tools clang-format clang-tidy gcc-mips-linux-gnu binutils-mips-linux-gnu build-essential python3
|
||||
|
||||
- name: Verify formatting on all files
|
||||
run: python3 tools/check_format.py --verbose
|
||||
|
||||
- name: Setup
|
||||
run: make setup -j $(nproc) TARGET=libgultra${{ matrix.suffix }} VERSION=${{ matrix.version }}
|
||||
|
||||
- name: Build libgultra${{ matrix.suffix }} ${{ matrix.version }}
|
||||
run: make -j $(nproc) TARGET=libgultra${{ matrix.suffix }} VERSION=${{ matrix.version }}
|
||||
|
||||
209
format.py
Normal file
209
format.py
Normal file
@@ -0,0 +1,209 @@
|
||||
#!/usr/bin/env python3
|
||||
|
||||
import argparse
|
||||
import glob
|
||||
import multiprocessing
|
||||
import os
|
||||
from pathlib import Path
|
||||
import re
|
||||
import shutil
|
||||
import subprocess
|
||||
import sys
|
||||
import tempfile
|
||||
from functools import partial
|
||||
from typing import List
|
||||
|
||||
|
||||
# clang-format, clang-tidy and clang-apply-replacements default version
|
||||
# This specific version is used when available, for more consistency between contributors
|
||||
CLANG_VER = 14
|
||||
|
||||
# Clang-Format options (see .clang-format for rules applied)
|
||||
FORMAT_OPTS = "-i -style=file"
|
||||
|
||||
# Clang-Tidy options (see .clang-tidy for checks enabled)
|
||||
TIDY_OPTS = "-p ."
|
||||
TIDY_FIX_OPTS = "--fix --fix-errors"
|
||||
|
||||
# Clang-Apply-Replacements options (used for multiprocessing)
|
||||
APPLY_OPTS = "--format --style=file"
|
||||
|
||||
# Compiler options used with Clang-Tidy
|
||||
# Normal warnings are disabled with -Wno-everything to focus only on tidying
|
||||
INCLUDES = "-Iinclude -Isrc -Ibuild/gc-eu-mq-dbg -I."
|
||||
DEFINES = "-D_LANGUAGE_C -DNON_MATCHING -DF3DEX_GBI_2 -DBUILD_CREATOR=\"\" -DBUILD_DATE=__DATE__ -DBUILD_TIME=__TIME__"
|
||||
COMPILER_OPTS = f"-fno-builtin -std=gnu90 -m32 -Wno-everything {INCLUDES} {DEFINES}"
|
||||
|
||||
|
||||
def get_clang_executable(allowed_executables: List[str]):
|
||||
for executable in allowed_executables:
|
||||
try:
|
||||
subprocess.check_call([executable, "--version"], stdout=subprocess.DEVNULL, stderr=subprocess.DEVNULL)
|
||||
return executable
|
||||
except FileNotFoundError or subprocess.CalledProcessError:
|
||||
pass
|
||||
return None
|
||||
|
||||
|
||||
def get_tidy_version(tidy_executable: str):
|
||||
tidy_version_run = subprocess.run([tidy_executable, "--version"], stdout=subprocess.PIPE, universal_newlines=True)
|
||||
match = re.search(r"LLVM version ([0-9]+)", tidy_version_run.stdout)
|
||||
return int(match.group(1))
|
||||
|
||||
|
||||
CLANG_FORMAT = get_clang_executable([f"clang-format-{CLANG_VER}", "clang-format"])
|
||||
if CLANG_FORMAT is None:
|
||||
sys.exit(f"Error: neither clang-format nor clang-format-{CLANG_VER} found")
|
||||
|
||||
CLANG_TIDY = get_clang_executable([f"clang-tidy-{CLANG_VER}", "clang-tidy"])
|
||||
if CLANG_TIDY is None:
|
||||
sys.exit(f"Error: neither clang-tidy nor clang-tidy-{CLANG_VER} found")
|
||||
|
||||
CLANG_APPLY_REPLACEMENTS = get_clang_executable([f"clang-apply-replacements-{CLANG_VER}", "clang-apply-replacements"])
|
||||
|
||||
# Try to detect the clang-tidy version and add --fix-notes for version 13+
|
||||
# This is used to ensure all fixes are applied properly in recent versions
|
||||
if get_tidy_version(CLANG_TIDY) >= 13:
|
||||
TIDY_FIX_OPTS += " --fix-notes"
|
||||
|
||||
|
||||
def list_chunks(list: List, chunk_length: int):
|
||||
for i in range(0, len(list), chunk_length):
|
||||
yield list[i : i + chunk_length]
|
||||
|
||||
|
||||
def run_clang_format(files: List[str]):
|
||||
exec_str = f"{CLANG_FORMAT} {FORMAT_OPTS} {' '.join(files)}"
|
||||
subprocess.run(exec_str, shell=True)
|
||||
|
||||
|
||||
def run_clang_tidy(files: List[str]):
|
||||
exec_str = f"{CLANG_TIDY} {TIDY_OPTS} {TIDY_FIX_OPTS} {' '.join(files)} -- {COMPILER_OPTS}"
|
||||
subprocess.run(exec_str, shell=True, stdout=subprocess.DEVNULL, stderr=subprocess.DEVNULL)
|
||||
|
||||
|
||||
def run_clang_tidy_with_export(tmp_dir: str, files: List[str]):
|
||||
(handle, tmp_file) = tempfile.mkstemp(suffix=".yaml", dir=tmp_dir)
|
||||
os.close(handle)
|
||||
|
||||
exec_str = f"{CLANG_TIDY} {TIDY_OPTS} --export-fixes={tmp_file} {' '.join(files)} -- {COMPILER_OPTS}"
|
||||
subprocess.run(exec_str, shell=True, stdout=subprocess.DEVNULL, stderr=subprocess.DEVNULL)
|
||||
|
||||
|
||||
def run_clang_apply_replacements(tmp_dir: str):
|
||||
exec_str = f"{CLANG_APPLY_REPLACEMENTS} {APPLY_OPTS} {tmp_dir}"
|
||||
subprocess.run(exec_str, shell=True)
|
||||
|
||||
|
||||
def cleanup_whitespace(file: str):
|
||||
"""
|
||||
Remove whitespace at the end of lines, and ensure all lines end with a newline.
|
||||
"""
|
||||
file_p = Path(file)
|
||||
contents = file_p.read_text(encoding="UTF-8")
|
||||
modified = False
|
||||
|
||||
contents, n_subst = re.subn(r"[^\S\n]+\n", "\n", contents)
|
||||
if n_subst != 0:
|
||||
modified = True
|
||||
|
||||
if contents and not contents.endswith("\n"):
|
||||
contents += "\n"
|
||||
modified = True
|
||||
|
||||
if modified:
|
||||
file_p.write_text(contents, encoding="UTF-8")
|
||||
|
||||
|
||||
def format_files(src_files: List[str], extra_files: List[str], nb_jobs: int):
|
||||
if nb_jobs != 1:
|
||||
print(f"Formatting files with {nb_jobs} jobs")
|
||||
else:
|
||||
print("Formatting files with a single job (consider using -j to make this faster)")
|
||||
|
||||
# Format files in chunks to improve performance while still utilizing jobs
|
||||
file_chunks = list(list_chunks(src_files, (len(src_files) // nb_jobs) + 1))
|
||||
|
||||
print("Running clang-format...")
|
||||
# clang-format only applies changes in the given files, so it's safe to run in parallel
|
||||
with multiprocessing.get_context("fork").Pool(nb_jobs) as pool:
|
||||
pool.map(run_clang_format, file_chunks)
|
||||
|
||||
print("Running clang-tidy...")
|
||||
if nb_jobs > 1:
|
||||
# clang-tidy may apply changes in #included files, so when running it in parallel we use --export-fixes
|
||||
# then we call clang-apply-replacements to apply all suggested fixes at the end
|
||||
tmp_dir = tempfile.mkdtemp()
|
||||
|
||||
try:
|
||||
with multiprocessing.get_context("fork").Pool(nb_jobs) as pool:
|
||||
pool.map(partial(run_clang_tidy_with_export, tmp_dir), file_chunks)
|
||||
|
||||
run_clang_apply_replacements(tmp_dir)
|
||||
finally:
|
||||
shutil.rmtree(tmp_dir)
|
||||
else:
|
||||
run_clang_tidy(src_files)
|
||||
|
||||
print("Cleaning up whitespace...")
|
||||
# Safe to do in parallel and can be applied to all types of files
|
||||
with multiprocessing.get_context("fork").Pool(nb_jobs) as pool:
|
||||
pool.map(cleanup_whitespace, src_files + extra_files)
|
||||
|
||||
print("Done formatting files.")
|
||||
|
||||
|
||||
def list_files_to_format():
|
||||
files = glob.glob("src/**/*.c", recursive=True)
|
||||
extra_files = (
|
||||
glob.glob("assets/**/*.xml", recursive=True)
|
||||
+ glob.glob("include/**/*.h", recursive=True)
|
||||
+ glob.glob("src/**/*.h", recursive=True)
|
||||
)
|
||||
return files, extra_files
|
||||
|
||||
|
||||
def main():
|
||||
parser = argparse.ArgumentParser(description="Format files in the codebase to enforce most style rules")
|
||||
parser.add_argument(
|
||||
"--show-paths",
|
||||
dest="show_paths",
|
||||
action="store_true",
|
||||
help="Print the paths to the clang-* binaries used",
|
||||
)
|
||||
parser.add_argument("files", metavar="file", nargs="*")
|
||||
parser.add_argument(
|
||||
"-j",
|
||||
dest="jobs",
|
||||
type=int,
|
||||
nargs="?",
|
||||
default=1,
|
||||
help="number of jobs to run (default: 1 without -j, number of cpus with -j)",
|
||||
)
|
||||
args = parser.parse_args()
|
||||
|
||||
if args.show_paths:
|
||||
import shutil
|
||||
|
||||
print("CLANG_FORMAT ->", shutil.which(CLANG_FORMAT))
|
||||
print("CLANG_TIDY ->", shutil.which(CLANG_TIDY))
|
||||
print("CLANG_APPLY_REPLACEMENTS ->", shutil.which(CLANG_APPLY_REPLACEMENTS))
|
||||
|
||||
nb_jobs = args.jobs or multiprocessing.cpu_count()
|
||||
if nb_jobs > 1:
|
||||
if CLANG_APPLY_REPLACEMENTS is None:
|
||||
sys.exit(
|
||||
f"Error: neither clang-apply-replacements nor clang-apply-replacements-{CLANG_VER} found (required to use -j)"
|
||||
)
|
||||
|
||||
if args.files:
|
||||
files = args.files
|
||||
extra_files = []
|
||||
else:
|
||||
files, extra_files = list_files_to_format()
|
||||
|
||||
format_files(files, extra_files, nb_jobs)
|
||||
|
||||
|
||||
if __name__ == "__main__":
|
||||
main()
|
||||
File diff suppressed because it is too large
Load Diff
501
include/PR/abi.h
501
include/PR/abi.h
File diff suppressed because it is too large
Load Diff
6012
include/PR/gbi.h
6012
include/PR/gbi.h
File diff suppressed because it is too large
Load Diff
File diff suppressed because it is too large
Load Diff
214
include/PR/gt.h
214
include/PR/gt.h
@@ -45,15 +45,15 @@
|
||||
**************************************************************************/
|
||||
|
||||
#ifndef _GT_H_
|
||||
#define _GT_H_
|
||||
#define _GT_H_
|
||||
|
||||
/* this file should be #included AFTER gbi.h */
|
||||
|
||||
#include "sptask.h"
|
||||
|
||||
#ifdef _LANGUAGE_C_PLUS_PLUS
|
||||
#ifdef _LANGUAGE_C_PLUS_PLUS
|
||||
extern "C" {
|
||||
#endif /* _LANGUAGE_C_PLUS_PLUS */
|
||||
#endif /* _LANGUAGE_C_PLUS_PLUS */
|
||||
|
||||
#include <PR/ultratypes.h>
|
||||
|
||||
@@ -61,19 +61,19 @@ extern "C" {
|
||||
* for the microcode.
|
||||
*/
|
||||
|
||||
/*
|
||||
/*
|
||||
* object state field: rendState
|
||||
*
|
||||
* This flag word is built up out of the bits from a
|
||||
* subset of the G_SETGEOMETRYMODE flags from gbi.h.
|
||||
*
|
||||
*
|
||||
* When each of these bits is '1', the comments below explain
|
||||
* the effect on the triangles.
|
||||
*/
|
||||
#define GT_ZBUFFER G_ZBUFFER
|
||||
#define GT_TEXTURE G_TEXTURE_ENABLE /* texture ON */
|
||||
#define GT_CULL_BACK G_CULL_BACK /* reject backfaces */
|
||||
#define GT_SHADING_SMOOTH G_SHADING_SMOOTH /* smooth shade ON */
|
||||
#define GT_ZBUFFER G_ZBUFFER
|
||||
#define GT_TEXTURE G_TEXTURE_ENABLE /* texture ON */
|
||||
#define GT_CULL_BACK G_CULL_BACK /* reject backfaces */
|
||||
#define GT_SHADING_SMOOTH G_SHADING_SMOOTH /* smooth shade ON */
|
||||
|
||||
/*
|
||||
* object state field: textureState
|
||||
@@ -83,43 +83,42 @@ extern "C" {
|
||||
* texture tile.
|
||||
*/
|
||||
|
||||
/*
|
||||
/*
|
||||
* object state field: flag
|
||||
*
|
||||
* This is a group of what would be pad bits. We use them for some
|
||||
* flag bits.
|
||||
*/
|
||||
#define GT_FLAG_NOMTX 0x01 /* don't load the matrix */
|
||||
#define GT_FLAG_NO_XFM 0x02 /* load vtx, use verbatim */
|
||||
#define GT_FLAG_XFM_ONLY 0x04 /* xform vtx, write to *TriN */
|
||||
|
||||
#define GT_FLAG_NOMTX 0x01 /* don't load the matrix */
|
||||
#define GT_FLAG_NO_XFM 0x02 /* load vtx, use verbatim */
|
||||
#define GT_FLAG_XFM_ONLY 0x04 /* xform vtx, write to *TriN */
|
||||
|
||||
#if defined(_LANGUAGE_C) || defined(_LANGUAGE_C_PLUS_PLUS)
|
||||
|
||||
/* turbo 3D ucode: */
|
||||
extern long long int gspTurbo3DTextStart[], gspTurbo3DTextEnd[];
|
||||
extern long long int gspTurbo3DDataStart[], gspTurbo3DDataEnd[];
|
||||
extern long long int gspTurbo3D_dramTextStart[], gspTurbo3D_dramTextEnd[];
|
||||
extern long long int gspTurbo3D_dramDataStart[], gspTurbo3D_dramDataEnd[];
|
||||
extern long long int gspTurbo3D_fifoTextStart[], gspTurbo3D_fifoTextEnd[];
|
||||
extern long long int gspTurbo3D_fifoDataStart[], gspTurbo3D_fifoDataEnd[];
|
||||
extern long long int gspTurbo3DTextStart[], gspTurbo3DTextEnd[];
|
||||
extern long long int gspTurbo3DDataStart[], gspTurbo3DDataEnd[];
|
||||
extern long long int gspTurbo3D_dramTextStart[], gspTurbo3D_dramTextEnd[];
|
||||
extern long long int gspTurbo3D_dramDataStart[], gspTurbo3D_dramDataEnd[];
|
||||
extern long long int gspTurbo3D_fifoTextStart[], gspTurbo3D_fifoTextEnd[];
|
||||
extern long long int gspTurbo3D_fifoDataStart[], gspTurbo3D_fifoDataEnd[];
|
||||
|
||||
/*
|
||||
* This is the global state structure. It's definition carefully
|
||||
* This is the global state structure. It's definition carefully
|
||||
* matches the ucode, so if this structure changes, you must also change
|
||||
* the ucode.
|
||||
*/
|
||||
typedef struct {
|
||||
u16 perspNorm; /* persp normalization */
|
||||
u16 pad0;
|
||||
u32 flag;
|
||||
Gfx rdpOthermode;
|
||||
u32 segBases[16]; /* table of segment base addrs (SEE NOTE!) */
|
||||
Vp viewport; /* the viewport to use */
|
||||
Gfx *rdpCmds; /* block of RDP data, process if !NULL
|
||||
* block terminated by gDPEndDisplayList()
|
||||
* (This is a segment address)
|
||||
*/
|
||||
u16 perspNorm; /* persp normalization */
|
||||
u16 pad0;
|
||||
u32 flag;
|
||||
Gfx rdpOthermode;
|
||||
u32 segBases[16]; /* table of segment base addrs (SEE NOTE!) */
|
||||
Vp viewport; /* the viewport to use */
|
||||
Gfx* rdpCmds; /* block of RDP data, process if !NULL
|
||||
* block terminated by gDPEndDisplayList()
|
||||
* (This is a segment address)
|
||||
*/
|
||||
} gtGlobState_t;
|
||||
|
||||
/* NOTE:
|
||||
@@ -129,11 +128,10 @@ typedef struct {
|
||||
*/
|
||||
|
||||
typedef union {
|
||||
gtGlobState_t sp;
|
||||
long long int force_structure_alignment;
|
||||
gtGlobState_t sp;
|
||||
long long int force_structure_alignment;
|
||||
} gtGlobState;
|
||||
|
||||
|
||||
/*
|
||||
* This is the 'state' structure associated with each object
|
||||
* to be rendered. It's definition carefully matches the
|
||||
@@ -141,38 +139,38 @@ typedef union {
|
||||
* the gtoff.c tool and the ucode.
|
||||
*/
|
||||
typedef struct {
|
||||
u32 renderState; /* render state */
|
||||
u32 textureState; /* texture state */
|
||||
u8 vtxCount; /* how many verts? */
|
||||
u8 vtxV0; /* where to load verts? */
|
||||
u8 triCount; /* how many tris? */
|
||||
u8 flag;
|
||||
Gfx *rdpCmds; /* ptr (segment address) to RDP DL */
|
||||
Gfx rdpOthermode;
|
||||
Mtx transform; /* the transform matrix to use */
|
||||
u32 renderState; /* render state */
|
||||
u32 textureState; /* texture state */
|
||||
u8 vtxCount; /* how many verts? */
|
||||
u8 vtxV0; /* where to load verts? */
|
||||
u8 triCount; /* how many tris? */
|
||||
u8 flag;
|
||||
Gfx* rdpCmds; /* ptr (segment address) to RDP DL */
|
||||
Gfx rdpOthermode;
|
||||
Mtx transform; /* the transform matrix to use */
|
||||
} gtState_t;
|
||||
|
||||
typedef union {
|
||||
gtState_t sp;
|
||||
long long int force_structure_alignment;
|
||||
gtState_t sp;
|
||||
long long int force_structure_alignment;
|
||||
} gtState;
|
||||
|
||||
/* gtStateLite : same as gtState, but no matrix (see flags below) */
|
||||
/* this structure must be identical to gtState! (bad) */
|
||||
typedef struct {
|
||||
u32 renderState; /* render state */
|
||||
u32 textureState; /* texture state */
|
||||
u8 vtxCount; /* how many verts? */
|
||||
u8 vtxV0; /* where to load verts? */
|
||||
u8 triCount; /* how many tris? */
|
||||
u8 flag;
|
||||
Gfx *rdpCmds; /* ptr (segment address) to RDP DL */
|
||||
Gfx rdpOthermode;
|
||||
u32 renderState; /* render state */
|
||||
u32 textureState; /* texture state */
|
||||
u8 vtxCount; /* how many verts? */
|
||||
u8 vtxV0; /* where to load verts? */
|
||||
u8 triCount; /* how many tris? */
|
||||
u8 flag;
|
||||
Gfx* rdpCmds; /* ptr (segment address) to RDP DL */
|
||||
Gfx rdpOthermode;
|
||||
} gtStateL_t;
|
||||
|
||||
typedef union {
|
||||
gtStateL_t sp;
|
||||
long long int force_structure_alignment;
|
||||
gtStateL_t sp;
|
||||
long long int force_structure_alignment;
|
||||
} gtStateL;
|
||||
|
||||
/*
|
||||
@@ -181,23 +179,21 @@ typedef union {
|
||||
*
|
||||
*/
|
||||
|
||||
|
||||
/*
|
||||
* This structure represents a single triangle, part of the
|
||||
* triangle list of the object to be rendered.
|
||||
*
|
||||
* NOTE: The triangle list MUST be aligned to an 8-byte boundary.
|
||||
* Since this structure is only 4 bytes, we are REQUIRING that
|
||||
* this structure only be used as an array of triangles, and we
|
||||
* depend on the MIPS C compiler (which always aligns arrays to
|
||||
* this structure only be used as an array of triangles, and we
|
||||
* depend on the MIPS C compiler (which always aligns arrays to
|
||||
* 8-byte boundaries). THIS IS DANGEROUS!!!!
|
||||
*
|
||||
*/
|
||||
typedef struct {
|
||||
u8 v0, v1, v2, flag; /* flag is which one for flat shade */
|
||||
u8 v0, v1, v2, flag; /* flag is which one for flat shade */
|
||||
} gtTriN;
|
||||
|
||||
|
||||
/*
|
||||
* This structure represents the transformed points. It is the format
|
||||
* of the points written out when GT_FLAG_XFM_ONLY is set, as well as
|
||||
@@ -214,29 +210,27 @@ typedef struct {
|
||||
*
|
||||
*/
|
||||
typedef struct {
|
||||
short int xscrn; /* x,y screen coordinates are SSSS10.2 */
|
||||
short int yscrn;
|
||||
int zscrn; /* z screen is S15.16 */
|
||||
short int xscrn; /* x,y screen coordinates are SSSS10.2 */
|
||||
short int yscrn;
|
||||
int zscrn; /* z screen is S15.16 */
|
||||
|
||||
short int s; /* transformed texture coord, S10.5 */
|
||||
short int t;
|
||||
short int s; /* transformed texture coord, S10.5 */
|
||||
short int t;
|
||||
|
||||
u8 r; /* color (or normal) */
|
||||
u8 g;
|
||||
u8 b;
|
||||
u8 a;
|
||||
u8 r; /* color (or normal) */
|
||||
u8 g;
|
||||
u8 b;
|
||||
u8 a;
|
||||
} gtVtxOut_t;
|
||||
|
||||
/* see "Data Structure" comment in gbi.h for information about why
|
||||
* we use this union.
|
||||
*/
|
||||
typedef union {
|
||||
gtVtxOut_t v;
|
||||
long long int force_structure_alignment;
|
||||
gtVtxOut_t v;
|
||||
long long int force_structure_alignment;
|
||||
} gtVtxOut;
|
||||
|
||||
|
||||
|
||||
/*
|
||||
* state field: rdpOthermode
|
||||
*
|
||||
@@ -244,10 +238,10 @@ typedef union {
|
||||
* requires the RDP othermode command to be cached by the host,
|
||||
* therefore we provide a different interface in libultra to help cache
|
||||
* this in the gt state (this word is just bits, you could pack them
|
||||
* on your own).
|
||||
* on your own).
|
||||
*
|
||||
* gtStateSetOthermode() accomplishs this, taking as arguments
|
||||
* the state, one of the following mode enums, and a piece of data
|
||||
* gtStateSetOthermode() accomplishs this, taking as arguments
|
||||
* the state, one of the following mode enums, and a piece of data
|
||||
* (othermode parameters from gbi.h).
|
||||
*
|
||||
* By definition, the othermode word from the gt state structure is sent
|
||||
@@ -255,16 +249,16 @@ typedef union {
|
||||
* othermode is *always* sent.
|
||||
*
|
||||
* Stated another way, NONE of the gbi RDP othermode commands equivalent
|
||||
* to those listed here are allowed in the rdpCmd[] field of the
|
||||
* to those listed here are allowed in the rdpCmd[] field of the
|
||||
* gt state structure.
|
||||
*
|
||||
* Notice also that many of these commands do not make sense for
|
||||
* the turbo ucode (they control features not supported, like mip-mapping).
|
||||
* the turbo ucode (they control features not supported, like mip-mapping).
|
||||
* They are only included here for completeness.
|
||||
*
|
||||
*/
|
||||
typedef enum {
|
||||
GT_CLEAR, /* special gt mode, clears othermode state */
|
||||
GT_CLEAR, /* special gt mode, clears othermode state */
|
||||
GT_ALPHACOMPARE,
|
||||
GT_ZSRCSEL,
|
||||
GT_RENDERMODE,
|
||||
@@ -286,39 +280,36 @@ typedef enum {
|
||||
* the above modes, the 'data' field comes from gbi.h, it is the data
|
||||
* field for the equivalent gbi setothermode macro.
|
||||
*/
|
||||
extern void gtStateSetOthermode(Gfx *om, gtStateOthermode_t mode, int data);
|
||||
extern void gtStateSetOthermode(Gfx* om, gtStateOthermode_t mode, int data);
|
||||
|
||||
/*
|
||||
/*
|
||||
* This call dumps a turbo display list for use with gbi2mem and RSPSIM
|
||||
*/
|
||||
#define GT_DUMPTURBO_HANGAFTER 64
|
||||
#define GT_DUMPTURBO_NOTEXTURES 128
|
||||
extern void gtDumpTurbo(OSTask *tp,u8 flags);
|
||||
#define GT_DUMPTURBO_HANGAFTER 64
|
||||
#define GT_DUMPTURBO_NOTEXTURES 128
|
||||
extern void gtDumpTurbo(OSTask* tp, u8 flags);
|
||||
|
||||
/*
|
||||
* Special macros to init othermode words to all 0's, a good default
|
||||
* value.
|
||||
*/
|
||||
#define gDPClearOtherMode(pkt) \
|
||||
{ \
|
||||
Gfx *_g = (Gfx *)(pkt); \
|
||||
\
|
||||
_g->words.w0 = _SHIFTL(G_RDPSETOTHERMODE, 24, 8); \
|
||||
_g->words.w1 = 0x0; \
|
||||
}
|
||||
#define gDPClearOtherMode(pkt) \
|
||||
{ \
|
||||
Gfx* _g = (Gfx*)(pkt); \
|
||||
\
|
||||
_g->words.w0 = _SHIFTL(G_RDPSETOTHERMODE, 24, 8); \
|
||||
_g->words.w1 = 0x0; \
|
||||
}
|
||||
|
||||
#define gsDPClearOtherMode() \
|
||||
{ \
|
||||
_SHIFTL(G_RDPSETOTHERMODE, 24, 8), 0x0 \
|
||||
}
|
||||
#define gsDPClearOtherMode() { _SHIFTL(G_RDPSETOTHERMODE, 24, 8), 0x0 }
|
||||
|
||||
/*
|
||||
* Special macros to end DP blocks (see above). These commands
|
||||
* generate all 0's, which the turbo ucode looks for. They *aren't*
|
||||
* real DP commands!
|
||||
*/
|
||||
#define gDPEndDisplayList(pkt) gSPNoOp(pkt)
|
||||
#define gsDPEndDisplayList() gsSPNoOp()
|
||||
#define gDPEndDisplayList(pkt) gSPNoOp(pkt)
|
||||
#define gsDPEndDisplayList() gsSPNoOp()
|
||||
|
||||
/*
|
||||
* This structure is a turbo 'object', the turbo display list is
|
||||
@@ -337,29 +328,28 @@ extern void gtDumpTurbo(OSTask *tp,u8 flags);
|
||||
*
|
||||
*/
|
||||
typedef struct {
|
||||
gtGlobState *gstatep; /* global state, usually NULL */
|
||||
gtState *statep; /* if this is NULL, end object processing */
|
||||
Vtx *vtxp; /* if this is NULL, use points in buffer */
|
||||
gtTriN *trip; /* if this is NULL, use tris in buffer */
|
||||
gtGlobState* gstatep; /* global state, usually NULL */
|
||||
gtState* statep; /* if this is NULL, end object processing */
|
||||
Vtx* vtxp; /* if this is NULL, use points in buffer */
|
||||
gtTriN* trip; /* if this is NULL, use tris in buffer */
|
||||
} gtGfx_t;
|
||||
|
||||
typedef union {
|
||||
gtGfx_t obj;
|
||||
long long int force_structure_alignment;
|
||||
gtGfx_t obj;
|
||||
long long int force_structure_alignment;
|
||||
} gtGfx;
|
||||
|
||||
#endif /* _LANGUAGE_C */
|
||||
|
||||
#endif /* _LANGUAGE_C */
|
||||
|
||||
#ifdef _LANGUAGE_ASSEMBLY
|
||||
#ifdef _LANGUAGE_ASSEMBLY
|
||||
#include <PR/gtoff.h>
|
||||
#endif /* _LANGUAGE_ASSEMBLY */
|
||||
#endif /* _LANGUAGE_ASSEMBLY */
|
||||
|
||||
#ifdef _LANGUAGE_C_PLUS_PLUS
|
||||
#ifdef _LANGUAGE_C_PLUS_PLUS
|
||||
}
|
||||
#endif /* _LANGUAGE_C_PLUS_PLUS */
|
||||
#endif /* _LANGUAGE_C_PLUS_PLUS */
|
||||
|
||||
#ifdef _LANGUAGE_MAKEROM
|
||||
#endif /* _LANGUAGE_MAKEROM */
|
||||
#ifdef _LANGUAGE_MAKEROM
|
||||
#endif /* _LANGUAGE_MAKEROM */
|
||||
|
||||
#endif /* _GT_H_ */
|
||||
#endif /* _GT_H_ */
|
||||
|
||||
276
include/PR/gu.h
276
include/PR/gu.h
@@ -27,162 +27,119 @@
|
||||
#include <PR/os_version.h>
|
||||
|
||||
#ifndef MAX
|
||||
#define MAX(a,b) (((a)>(b))?(a):(b))
|
||||
#define MAX(a, b) (((a) > (b)) ? (a) : (b))
|
||||
#endif
|
||||
#ifndef MIN
|
||||
#define MIN(a,b) (((a)<(b))?(a):(b))
|
||||
#define MIN(a, b) (((a) < (b)) ? (a) : (b))
|
||||
#endif
|
||||
|
||||
#define M_PI 3.14159265358979323846
|
||||
#define M_DTOR (3.14159265358979323846/180.0)
|
||||
#define M_PI 3.14159265358979323846
|
||||
#define M_DTOR (3.14159265358979323846 / 180.0)
|
||||
|
||||
#define FTOFIX32(x) (long)((x) * (float)0x00010000)
|
||||
#define FIX32TOF(x) ((float)(x) * (1.0f / (float)0x00010000))
|
||||
#define FTOFRAC8(x) ((int) MIN(((x) * (128.0f)), 127.0f) & 0xff)
|
||||
#define FTOFIX32(x) (long)((x) * (float)0x00010000)
|
||||
#define FIX32TOF(x) ((float)(x) * (1.0f / (float)0x00010000))
|
||||
#define FTOFRAC8(x) ((int)MIN(((x) * (128.0f)), 127.0f) & 0xff)
|
||||
|
||||
#define FILTER_WRAP 0
|
||||
#define FILTER_CLAMP 1
|
||||
#define FILTER_WRAP 0
|
||||
#define FILTER_CLAMP 1
|
||||
|
||||
#define RAND(x) (guRandom()%x) /* random number between 0 to x */
|
||||
#define RAND(x) (guRandom() % x) /* random number between 0 to x */
|
||||
|
||||
/*
|
||||
* Data Structures
|
||||
*/
|
||||
typedef struct {
|
||||
unsigned char *base;
|
||||
int fmt, siz;
|
||||
int xsize, ysize;
|
||||
int lsize;
|
||||
/* current tile info */
|
||||
int addr;
|
||||
int w, h;
|
||||
int s, t;
|
||||
unsigned char* base;
|
||||
int fmt, siz;
|
||||
int xsize, ysize;
|
||||
int lsize;
|
||||
/* current tile info */
|
||||
int addr;
|
||||
int w, h;
|
||||
int s, t;
|
||||
} Image;
|
||||
|
||||
typedef struct {
|
||||
float col[3];
|
||||
float pos[3];
|
||||
float a1, a2; /* actual color = col/(a1*dist + a2) */
|
||||
float col[3];
|
||||
float pos[3];
|
||||
float a1, a2; /* actual color = col/(a1*dist + a2) */
|
||||
} PositionalLight;
|
||||
|
||||
|
||||
/*
|
||||
* Function Prototypes
|
||||
*/
|
||||
|
||||
extern int guLoadTextureBlockMipMap(Gfx **glist, unsigned char *tbuf, Image *im,
|
||||
unsigned char startTile, unsigned char pal, unsigned char cms,
|
||||
unsigned char cmt, unsigned char masks, unsigned char maskt,
|
||||
unsigned char shifts, unsigned char shiftt, unsigned char cfs,
|
||||
unsigned char cft);
|
||||
extern int guLoadTextureBlockMipMap(Gfx** glist, unsigned char* tbuf, Image* im, unsigned char startTile,
|
||||
unsigned char pal, unsigned char cms, unsigned char cmt, unsigned char masks,
|
||||
unsigned char maskt, unsigned char shifts, unsigned char shiftt, unsigned char cfs,
|
||||
unsigned char cft);
|
||||
|
||||
extern int guGetDPLoadTextureTileSz (int ult, int lrt);
|
||||
extern void guDPLoadTextureTile (Gfx *glistp, void *timg,
|
||||
int texl_fmt, int texl_size,
|
||||
int img_width, int img_height,
|
||||
int uls, int ult, int lrs, int lrt,
|
||||
int palette,
|
||||
int cms, int cmt,
|
||||
int masks, int maskt,
|
||||
int shifts, int shiftt);
|
||||
extern int guGetDPLoadTextureTileSz(int ult, int lrt);
|
||||
extern void guDPLoadTextureTile(Gfx* glistp, void* timg, int texl_fmt, int texl_size, int img_width, int img_height,
|
||||
int uls, int ult, int lrs, int lrt, int palette, int cms, int cmt, int masks, int maskt,
|
||||
int shifts, int shiftt);
|
||||
|
||||
|
||||
/*
|
||||
/*
|
||||
* matrix operations:
|
||||
*
|
||||
* The 'F' version is floating point, in case the application wants
|
||||
* to do matrix manipulations and convert to fixed-point at the last
|
||||
* minute.
|
||||
*/
|
||||
extern void guMtxIdent(Mtx *m);
|
||||
extern void guMtxIdent(Mtx* m);
|
||||
extern void guMtxIdentF(float mf[4][4]);
|
||||
extern void guOrtho(Mtx *m, float l, float r, float b, float t,
|
||||
float n, float f, float scale);
|
||||
extern void guOrthoF(float mf[4][4], float l, float r, float b, float t,
|
||||
float n, float f, float scale);
|
||||
extern void guFrustum(Mtx *m, float l, float r, float b, float t,
|
||||
float n, float f, float scale);
|
||||
extern void guFrustumF(float mf[4][4], float l, float r, float b, float t,
|
||||
float n, float f, float scale);
|
||||
extern void guPerspective(Mtx *m, u16 *perspNorm, float fovy,
|
||||
float aspect, float near, float far, float scale);
|
||||
extern void guPerspectiveF(float mf[4][4], u16 *perspNorm, float fovy,
|
||||
float aspect, float near, float far, float scale);
|
||||
extern void guLookAt(Mtx *m,
|
||||
float xEye, float yEye, float zEye,
|
||||
float xAt, float yAt, float zAt,
|
||||
float xUp, float yUp, float zUp);
|
||||
extern void guLookAtF(float mf[4][4], float xEye, float yEye, float zEye,
|
||||
float xAt, float yAt, float zAt,
|
||||
float xUp, float yUp, float zUp);
|
||||
extern void guLookAtReflect(Mtx *m, LookAt *l,
|
||||
float xEye, float yEye, float zEye,
|
||||
float xAt, float yAt, float zAt,
|
||||
float xUp, float yUp, float zUp);
|
||||
extern void guLookAtReflectF(float mf[4][4], LookAt *l,
|
||||
float xEye, float yEye, float zEye,
|
||||
float xAt, float yAt, float zAt,
|
||||
float xUp, float yUp, float zUp);
|
||||
extern void guLookAtHilite(Mtx *m, LookAt *l, Hilite *h,
|
||||
float xEye, float yEye, float zEye,
|
||||
float xAt, float yAt, float zAt,
|
||||
float xUp, float yUp, float zUp,
|
||||
float xl1, float yl1, float zl1,
|
||||
float xl2, float yl2, float zl2,
|
||||
int twidth, int theight);
|
||||
extern void guLookAtHiliteF(float mf[4][4], LookAt *l, Hilite *h,
|
||||
float xEye, float yEye, float zEye,
|
||||
float xAt, float yAt, float zAt,
|
||||
float xUp, float yUp, float zUp,
|
||||
float xl1, float yl1, float zl1,
|
||||
float xl2, float yl2, float zl2,
|
||||
int twidth, int theight);
|
||||
extern void guLookAtStereo(Mtx *m,
|
||||
float xEye, float yEye, float zEye,
|
||||
float xAt, float yAt, float zAt,
|
||||
float xUp, float yUp, float zUp,
|
||||
float eyedist);
|
||||
extern void guLookAtStereoF(float mf[4][4],
|
||||
float xEye, float yEye, float zEye,
|
||||
float xAt, float yAt, float zAt,
|
||||
float xUp, float yUp, float zUp,
|
||||
float eyedist);
|
||||
extern void guRotate(Mtx *m, float a, float x, float y, float z);
|
||||
extern void guOrtho(Mtx* m, float l, float r, float b, float t, float n, float f, float scale);
|
||||
extern void guOrthoF(float mf[4][4], float l, float r, float b, float t, float n, float f, float scale);
|
||||
extern void guFrustum(Mtx* m, float l, float r, float b, float t, float n, float f, float scale);
|
||||
extern void guFrustumF(float mf[4][4], float l, float r, float b, float t, float n, float f, float scale);
|
||||
extern void guPerspective(Mtx* m, u16* perspNorm, float fovy, float aspect, float near, float far, float scale);
|
||||
extern void guPerspectiveF(float mf[4][4], u16* perspNorm, float fovy, float aspect, float near, float far,
|
||||
float scale);
|
||||
extern void guLookAt(Mtx* m, float xEye, float yEye, float zEye, float xAt, float yAt, float zAt, float xUp, float yUp,
|
||||
float zUp);
|
||||
extern void guLookAtF(float mf[4][4], float xEye, float yEye, float zEye, float xAt, float yAt, float zAt, float xUp,
|
||||
float yUp, float zUp);
|
||||
extern void guLookAtReflect(Mtx* m, LookAt* l, float xEye, float yEye, float zEye, float xAt, float yAt, float zAt,
|
||||
float xUp, float yUp, float zUp);
|
||||
extern void guLookAtReflectF(float mf[4][4], LookAt* l, float xEye, float yEye, float zEye, float xAt, float yAt,
|
||||
float zAt, float xUp, float yUp, float zUp);
|
||||
extern void guLookAtHilite(Mtx* m, LookAt* l, Hilite* h, float xEye, float yEye, float zEye, float xAt, float yAt,
|
||||
float zAt, float xUp, float yUp, float zUp, float xl1, float yl1, float zl1, float xl2,
|
||||
float yl2, float zl2, int twidth, int theight);
|
||||
extern void guLookAtHiliteF(float mf[4][4], LookAt* l, Hilite* h, float xEye, float yEye, float zEye, float xAt,
|
||||
float yAt, float zAt, float xUp, float yUp, float zUp, float xl1, float yl1, float zl1,
|
||||
float xl2, float yl2, float zl2, int twidth, int theight);
|
||||
extern void guLookAtStereo(Mtx* m, float xEye, float yEye, float zEye, float xAt, float yAt, float zAt, float xUp,
|
||||
float yUp, float zUp, float eyedist);
|
||||
extern void guLookAtStereoF(float mf[4][4], float xEye, float yEye, float zEye, float xAt, float yAt, float zAt,
|
||||
float xUp, float yUp, float zUp, float eyedist);
|
||||
extern void guRotate(Mtx* m, float a, float x, float y, float z);
|
||||
extern void guRotateF(float mf[4][4], float a, float x, float y, float z);
|
||||
extern void guRotateRPY(Mtx *m, float r, float p, float y);
|
||||
extern void guRotateRPY(Mtx* m, float r, float p, float y);
|
||||
extern void guRotateRPYF(float mf[4][4], float r, float p, float h);
|
||||
extern void guAlign(Mtx *m, float a, float x, float y, float z);
|
||||
extern void guAlign(Mtx* m, float a, float x, float y, float z);
|
||||
extern void guAlignF(float mf[4][4], float a, float x, float y, float z);
|
||||
extern void guScale(Mtx *m, float x, float y, float z);
|
||||
extern void guScale(Mtx* m, float x, float y, float z);
|
||||
extern void guScaleF(float mf[4][4], float x, float y, float z);
|
||||
extern void guTranslate(Mtx *m, float x, float y, float z);
|
||||
extern void guTranslate(Mtx* m, float x, float y, float z);
|
||||
extern void guTranslateF(float mf[4][4], float x, float y, float z);
|
||||
extern void guPosition(Mtx *m, float r, float p, float h, float s,
|
||||
float x, float y, float z);
|
||||
extern void guPositionF(float mf[4][4], float r, float p, float h, float s,
|
||||
float x, float y, float z);
|
||||
extern void guMtxF2L(float mf[4][4], Mtx *m);
|
||||
extern void guMtxL2F(float mf[4][4], Mtx *m);
|
||||
extern void guPosition(Mtx* m, float r, float p, float h, float s, float x, float y, float z);
|
||||
extern void guPositionF(float mf[4][4], float r, float p, float h, float s, float x, float y, float z);
|
||||
extern void guMtxF2L(float mf[4][4], Mtx* m);
|
||||
extern void guMtxL2F(float mf[4][4], Mtx* m);
|
||||
extern void guMtxCatF(float m[4][4], float n[4][4], float r[4][4]);
|
||||
extern void guMtxCatL(Mtx *m, Mtx *n, Mtx *res);
|
||||
extern void guMtxXFMF(float mf[4][4], float x, float y, float z,
|
||||
float *ox, float *oy, float *oz);
|
||||
extern void guMtxXFML(Mtx *m, float x, float y, float z,
|
||||
float *ox, float *oy, float *oz);
|
||||
extern void guMtxCatL(Mtx* m, Mtx* n, Mtx* res);
|
||||
extern void guMtxXFMF(float mf[4][4], float x, float y, float z, float* ox, float* oy, float* oz);
|
||||
extern void guMtxXFML(Mtx* m, float x, float y, float z, float* ox, float* oy, float* oz);
|
||||
|
||||
/* vector utility: */
|
||||
extern void guNormalize(float *x, float *y, float *z);
|
||||
extern void guNormalize(float* x, float* y, float* z);
|
||||
|
||||
/* light utilities: */
|
||||
void guPosLight(PositionalLight *pl, Light *l,
|
||||
float xOb, float yOb, float zOb);
|
||||
void guPosLightHilite(PositionalLight *pl1, PositionalLight *pl2,
|
||||
Light *l1, Light *l2,
|
||||
LookAt *l, Hilite *h,
|
||||
float xEye, float yEye, float zEye,
|
||||
float xOb, float yOb, float zOb,
|
||||
float xUp, float yUp, float zUp,
|
||||
int twidth, int theight);
|
||||
void guPosLight(PositionalLight* pl, Light* l, float xOb, float yOb, float zOb);
|
||||
void guPosLightHilite(PositionalLight* pl1, PositionalLight* pl2, Light* l1, Light* l2, LookAt* l, Hilite* h,
|
||||
float xEye, float yEye, float zEye, float xOb, float yOb, float zOb, float xUp, float yUp,
|
||||
float zUp, int twidth, int theight);
|
||||
extern int guRandom(void);
|
||||
|
||||
/*
|
||||
@@ -190,8 +147,8 @@ extern int guRandom(void);
|
||||
*/
|
||||
extern float sinf(float angle);
|
||||
extern float cosf(float angle);
|
||||
extern signed short sins (unsigned short angle);
|
||||
extern signed short coss (unsigned short angle);
|
||||
extern signed short sins(unsigned short angle);
|
||||
extern signed short coss(unsigned short angle);
|
||||
extern float sqrtf(float value);
|
||||
#if defined(__sgi) && BUILD_VERSION >= VERSION_K
|
||||
#pragma intrinsic(sqrtf);
|
||||
@@ -201,70 +158,59 @@ extern float sqrtf(float value);
|
||||
* Dump routines for low-level display lists
|
||||
*/
|
||||
/* flag values for guParseRdpDL() */
|
||||
#define GU_PARSERDP_VERBOSE 1
|
||||
#define GU_PARSERDP_PRAREA 2
|
||||
#define GU_PARSERDP_PRHISTO 4
|
||||
#define GU_PARSERDP_DUMPONLY 32 /* doesn't need to be same as */
|
||||
/* GU_PARSEGBI_DUMPOLNY, but this */
|
||||
/* allows app to use interchangeably */
|
||||
#define GU_PARSERDP_VERBOSE 1
|
||||
#define GU_PARSERDP_PRAREA 2
|
||||
#define GU_PARSERDP_PRHISTO 4
|
||||
#define GU_PARSERDP_DUMPONLY 32 /* doesn't need to be same as */
|
||||
/* GU_PARSEGBI_DUMPOLNY, but this */
|
||||
/* allows app to use interchangeably */
|
||||
|
||||
extern void guParseRdpDL(u64 *rdp_dl, u64 nbytes, u8 flags);
|
||||
extern void guParseString(char *StringPointer, u64 nbytes);
|
||||
extern void guParseRdpDL(u64* rdp_dl, u64 nbytes, u8 flags);
|
||||
extern void guParseString(char* StringPointer, u64 nbytes);
|
||||
|
||||
/*
|
||||
* NO LONGER SUPPORTED,
|
||||
/*
|
||||
* NO LONGER SUPPORTED,
|
||||
* use guParseRdpDL with GU_PARSERDP_DUMPONLY flags
|
||||
*/
|
||||
/* extern void guDumpRawRdpDL(u64 *rdp_dl, u64 nbytes); */
|
||||
|
||||
/* flag values for guBlinkRdpDL() */
|
||||
#define GU_BLINKRDP_HILITE 1
|
||||
#define GU_BLINKRDP_EXTRACT 2
|
||||
#define GU_BLINKRDP_HILITE 1
|
||||
#define GU_BLINKRDP_EXTRACT 2
|
||||
|
||||
extern void guBlinkRdpDL(u64* rdp_dl_in, u64 nbytes_in, u64* rdp_dl_out, u64* nbytes_out, u32 x, u32 y, u32 radius,
|
||||
u8 red, u8 green, u8 blue, u8 flags);
|
||||
|
||||
extern void
|
||||
guBlinkRdpDL(u64 *rdp_dl_in, u64 nbytes_in,
|
||||
u64 *rdp_dl_out, u64 *nbytes_out,
|
||||
u32 x, u32 y, u32 radius,
|
||||
u8 red, u8 green, u8 blue,
|
||||
u8 flags);
|
||||
|
||||
/* flag values for guParseGbiDL() */
|
||||
#define GU_PARSEGBI_ROWMAJOR 1
|
||||
#define GU_PARSEGBI_NONEST 2
|
||||
#define GU_PARSEGBI_FLTMTX 4
|
||||
#define GU_PARSEGBI_SHOWDMA 8
|
||||
#define GU_PARSEGBI_ALLMTX 16
|
||||
#define GU_PARSEGBI_DUMPONLY 32
|
||||
#define GU_PARSEGBI_ROWMAJOR 1
|
||||
#define GU_PARSEGBI_NONEST 2
|
||||
#define GU_PARSEGBI_FLTMTX 4
|
||||
#define GU_PARSEGBI_SHOWDMA 8
|
||||
#define GU_PARSEGBI_ALLMTX 16
|
||||
#define GU_PARSEGBI_DUMPONLY 32
|
||||
/*
|
||||
#define GU_PARSEGBI_HANGAFTER 64
|
||||
#define GU_PARSEGBI_NOTEXTURES 128
|
||||
*/
|
||||
extern void guParseGbiDL(u64 *gbi_dl, u32 nbytes, u8 flags);
|
||||
extern void guDumpGbiDL(OSTask *tp,u8 flags);
|
||||
extern void guParseGbiDL(u64* gbi_dl, u32 nbytes, u8 flags);
|
||||
extern void guDumpGbiDL(OSTask* tp, u8 flags);
|
||||
|
||||
#define GU_PARSE_GBI_TYPE 1
|
||||
#define GU_PARSE_RDP_TYPE 2
|
||||
#define GU_PARSE_READY 3
|
||||
#define GU_PARSE_MEM_BLOCK 4
|
||||
#define GU_PARSE_ABI_TYPE 5
|
||||
#define GU_PARSE_STRING_TYPE 6
|
||||
#define GU_PARSE_GBI_TYPE 1
|
||||
#define GU_PARSE_RDP_TYPE 2
|
||||
#define GU_PARSE_READY 3
|
||||
#define GU_PARSE_MEM_BLOCK 4
|
||||
#define GU_PARSE_ABI_TYPE 5
|
||||
#define GU_PARSE_STRING_TYPE 6
|
||||
|
||||
typedef struct {
|
||||
int dataSize;
|
||||
int dlType;
|
||||
int flags;
|
||||
u32 paddr;
|
||||
int dataSize;
|
||||
int dlType;
|
||||
int flags;
|
||||
u32 paddr;
|
||||
} guDLPrintCB;
|
||||
|
||||
void guSprite2DInit(uSprite *SpritePointer,
|
||||
void *SourceImagePointer,
|
||||
void *TlutPointer,
|
||||
int Stride,
|
||||
int SubImageWidth,
|
||||
int SubImageHeight,
|
||||
int SourceImageType,
|
||||
int SourceImageBitSize,
|
||||
int SourceImageOffsetS,
|
||||
int SourceImageOffsetT);
|
||||
void guSprite2DInit(uSprite* SpritePointer, void* SourceImagePointer, void* TlutPointer, int Stride, int SubImageWidth,
|
||||
int SubImageHeight, int SourceImageType, int SourceImageBitSize, int SourceImageOffsetS,
|
||||
int SourceImageOffsetT);
|
||||
|
||||
#endif /* !_GU_H_ */
|
||||
|
||||
File diff suppressed because it is too large
Load Diff
@@ -1,5 +1,5 @@
|
||||
#ifndef _MBI_H_
|
||||
#define _MBI_H_
|
||||
#define _MBI_H_
|
||||
|
||||
/**************************************************************************
|
||||
* *
|
||||
@@ -29,13 +29,12 @@
|
||||
*
|
||||
*/
|
||||
|
||||
|
||||
/*
|
||||
* the SHIFT macros are used to build display list commands, inserting
|
||||
* bit-fields into a 32-bit word. They take a value, a shift amount,
|
||||
* bit-fields into a 32-bit word. They take a value, a shift amount,
|
||||
* and a width.
|
||||
*
|
||||
* For the left shift, the lower bits of the value are masked,
|
||||
* For the left shift, the lower bits of the value are masked,
|
||||
* then shifted left.
|
||||
*
|
||||
* For the right shift, the value is shifted right, then the lower bits
|
||||
@@ -44,15 +43,13 @@
|
||||
* (NOTE: _SHIFTL(v, 0, 32) won't work, just use an assignment)
|
||||
*
|
||||
*/
|
||||
#define _SHIFTL(v, s, w) \
|
||||
((unsigned int) (((unsigned int)(v) & ((0x01 << (w)) - 1)) << (s)))
|
||||
#define _SHIFTR(v, s, w) \
|
||||
((unsigned int)(((unsigned int)(v) >> (s)) & ((0x01 << (w)) - 1)))
|
||||
#define _SHIFTL(v, s, w) ((unsigned int)(((unsigned int)(v) & ((0x01 << (w)) - 1)) << (s)))
|
||||
#define _SHIFTR(v, s, w) ((unsigned int)(((unsigned int)(v) >> (s)) & ((0x01 << (w)) - 1)))
|
||||
|
||||
#define _SHIFT _SHIFTL /* old, for compatibility only */
|
||||
#define _SHIFT _SHIFTL /* old, for compatibility only */
|
||||
|
||||
#define G_ON (1)
|
||||
#define G_OFF (0)
|
||||
#define G_ON (1)
|
||||
#define G_OFF (0)
|
||||
|
||||
/**************************************************************************
|
||||
*
|
||||
@@ -76,11 +73,11 @@
|
||||
*
|
||||
**************************************************************************/
|
||||
|
||||
#define M_GFXTASK 1
|
||||
#define M_AUDTASK 2
|
||||
#define M_VIDTASK 3
|
||||
#define M_HVQTASK 6
|
||||
#define M_HVQMTASK 7
|
||||
#define M_GFXTASK 1
|
||||
#define M_AUDTASK 2
|
||||
#define M_VIDTASK 3
|
||||
#define M_HVQTASK 6
|
||||
#define M_HVQMTASK 7
|
||||
|
||||
/**************************************************************************
|
||||
*
|
||||
@@ -88,10 +85,10 @@
|
||||
*
|
||||
**************************************************************************/
|
||||
|
||||
#define NUM_SEGMENTS (16)
|
||||
#define SEGMENT_OFFSET(a) ((unsigned int)(a) & 0x00ffffff)
|
||||
#define SEGMENT_NUMBER(a) (((unsigned int)(a) << 4) >> 28)
|
||||
#define SEGMENT_ADDR(num, off) (((num) << 24) + (off))
|
||||
#define NUM_SEGMENTS (16)
|
||||
#define SEGMENT_OFFSET(a) ((unsigned int)(a) & 0x00ffffff)
|
||||
#define SEGMENT_NUMBER(a) (((unsigned int)(a) << 4) >> 28)
|
||||
#define SEGMENT_ADDR(num, off) (((num) << 24) + (off))
|
||||
|
||||
#ifndef NULL
|
||||
#define NULL 0
|
||||
|
||||
@@ -21,14 +21,14 @@
|
||||
|
||||
/*---------------------------------------------------------------------*
|
||||
Copyright (C) 1998 Nintendo. (Originated by SGI)
|
||||
|
||||
|
||||
$RCSfile: os.h,v $
|
||||
$Revision: 1.168 $
|
||||
$Date: 2000/06/15 06:24:52 $
|
||||
*---------------------------------------------------------------------*/
|
||||
|
||||
#ifndef _OS_H_
|
||||
#define _OS_H_
|
||||
#define _OS_H_
|
||||
|
||||
#include <PR/os_thread.h>
|
||||
#include <PR/os_message.h>
|
||||
@@ -76,30 +76,29 @@ extern "C" {
|
||||
* SIM (SI Manager)
|
||||
*
|
||||
*/
|
||||
#define OS_PIM_STACKSIZE 4096
|
||||
#define OS_VIM_STACKSIZE 4096
|
||||
#define OS_SIM_STACKSIZE 4096
|
||||
#define OS_PIM_STACKSIZE 4096
|
||||
#define OS_VIM_STACKSIZE 4096
|
||||
#define OS_SIM_STACKSIZE 4096
|
||||
|
||||
#define OS_MIN_STACKSIZE 72
|
||||
#define OS_MIN_STACKSIZE 72
|
||||
|
||||
/*
|
||||
* Leo Disk
|
||||
/*
|
||||
* Leo Disk
|
||||
*/
|
||||
|
||||
/* transfer mode */
|
||||
|
||||
#define LEO_BLOCK_MODE 1
|
||||
#define LEO_TRACK_MODE 2
|
||||
#define LEO_SECTOR_MODE 3
|
||||
#define LEO_BLOCK_MODE 1
|
||||
#define LEO_TRACK_MODE 2
|
||||
#define LEO_SECTOR_MODE 3
|
||||
|
||||
/*
|
||||
* Boot addresses
|
||||
*/
|
||||
#define BOOT_ADDRESS_ULTRA 0x80000400
|
||||
#define BOOT_ADDRESS_COSIM 0x80002000
|
||||
#define BOOT_ADDRESS_EMU 0x20010000
|
||||
#define BOOT_ADDRESS_INDY 0x88100000
|
||||
|
||||
#define BOOT_ADDRESS_ULTRA 0x80000400
|
||||
#define BOOT_ADDRESS_COSIM 0x80002000
|
||||
#define BOOT_ADDRESS_EMU 0x20010000
|
||||
#define BOOT_ADDRESS_INDY 0x88100000
|
||||
|
||||
#ifdef _LANGUAGE_C_PLUS_PLUS
|
||||
}
|
||||
|
||||
@@ -21,14 +21,14 @@
|
||||
|
||||
/*---------------------------------------------------------------------*
|
||||
Copyright (C) 1998 Nintendo. (Originated by SGI)
|
||||
|
||||
|
||||
$RCSfile: os_ai.h,v $
|
||||
$Revision: 1.1 $
|
||||
$Date: 1998/10/09 08:01:04 $
|
||||
*---------------------------------------------------------------------*/
|
||||
|
||||
#ifndef _OS_AI_H_
|
||||
#define _OS_AI_H_
|
||||
#define _OS_AI_H_
|
||||
|
||||
#ifdef _LANGUAGE_C_PLUS_PLUS
|
||||
extern "C" {
|
||||
@@ -44,7 +44,6 @@ extern "C" {
|
||||
*
|
||||
*/
|
||||
|
||||
|
||||
#endif /* defined(_LANGUAGE_C) || defined(_LANGUAGE_C_PLUS_PLUS) */
|
||||
|
||||
/**************************************************************************
|
||||
@@ -53,7 +52,6 @@ extern "C" {
|
||||
*
|
||||
*/
|
||||
|
||||
|
||||
#if defined(_LANGUAGE_C) || defined(_LANGUAGE_C_PLUS_PLUS)
|
||||
|
||||
/**************************************************************************
|
||||
@@ -62,14 +60,12 @@ extern "C" {
|
||||
*
|
||||
*/
|
||||
|
||||
|
||||
/**************************************************************************
|
||||
*
|
||||
* Extern variables
|
||||
*
|
||||
*/
|
||||
|
||||
|
||||
/**************************************************************************
|
||||
*
|
||||
* Function prototypes
|
||||
@@ -77,13 +73,12 @@ extern "C" {
|
||||
*/
|
||||
|
||||
/* Audio interface (Ai) */
|
||||
extern u32 osAiGetStatus(void);
|
||||
extern u32 osAiGetLength(void);
|
||||
extern s32 osAiSetFrequency(u32);
|
||||
extern s32 osAiSetNextBuffer(void *, u32);
|
||||
extern u32 osAiGetStatus(void);
|
||||
extern u32 osAiGetLength(void);
|
||||
extern s32 osAiSetFrequency(u32);
|
||||
extern s32 osAiSetNextBuffer(void*, u32);
|
||||
|
||||
|
||||
#endif /* defined(_LANGUAGE_C) || defined(_LANGUAGE_C_PLUS_PLUS) */
|
||||
#endif /* defined(_LANGUAGE_C) || defined(_LANGUAGE_C_PLUS_PLUS) */
|
||||
|
||||
#ifdef _LANGUAGE_C_PLUS_PLUS
|
||||
}
|
||||
|
||||
@@ -21,14 +21,14 @@
|
||||
|
||||
/*---------------------------------------------------------------------*
|
||||
Copyright (C) 1998 Nintendo. (Originated by SGI)
|
||||
|
||||
|
||||
$RCSfile: os_cache.h,v $
|
||||
$Revision: 1.1 $
|
||||
$Date: 1998/10/09 08:01:04 $
|
||||
*---------------------------------------------------------------------*/
|
||||
|
||||
#ifndef _OS_CACHE_H_
|
||||
#define _OS_CACHE_H_
|
||||
#define _OS_CACHE_H_
|
||||
|
||||
#ifdef _LANGUAGE_C_PLUS_PLUS
|
||||
extern "C" {
|
||||
@@ -44,7 +44,6 @@ extern "C" {
|
||||
*
|
||||
*/
|
||||
|
||||
|
||||
#endif /* defined(_LANGUAGE_C) || defined(_LANGUAGE_C_PLUS_PLUS) */
|
||||
|
||||
/**************************************************************************
|
||||
@@ -53,7 +52,6 @@ extern "C" {
|
||||
*
|
||||
*/
|
||||
|
||||
|
||||
#if defined(_LANGUAGE_C) || defined(_LANGUAGE_C_PLUS_PLUS)
|
||||
|
||||
/**************************************************************************
|
||||
@@ -62,9 +60,8 @@ extern "C" {
|
||||
*
|
||||
*/
|
||||
|
||||
#define OS_DCACHE_ROUNDUP_ADDR(x) (void *)(((((u32)(x)+0xf)/0x10)*0x10))
|
||||
#define OS_DCACHE_ROUNDUP_SIZE(x) (u32)(((((u32)(x)+0xf)/0x10)*0x10))
|
||||
|
||||
#define OS_DCACHE_ROUNDUP_ADDR(x) (void*)(((((u32)(x) + 0xf) / 0x10) * 0x10))
|
||||
#define OS_DCACHE_ROUNDUP_SIZE(x) (u32)(((((u32)(x) + 0xf) / 0x10) * 0x10))
|
||||
|
||||
/**************************************************************************
|
||||
*
|
||||
@@ -72,7 +69,6 @@ extern "C" {
|
||||
*
|
||||
*/
|
||||
|
||||
|
||||
/**************************************************************************
|
||||
*
|
||||
* Function prototypes
|
||||
@@ -81,13 +77,12 @@ extern "C" {
|
||||
|
||||
/* Cache operations and macros */
|
||||
|
||||
extern void osInvalDCache(void *, s32);
|
||||
extern void osInvalICache(void *, s32);
|
||||
extern void osWritebackDCache(void *, s32);
|
||||
extern void osWritebackDCacheAll(void);
|
||||
extern void osInvalDCache(void*, s32);
|
||||
extern void osInvalICache(void*, s32);
|
||||
extern void osWritebackDCache(void*, s32);
|
||||
extern void osWritebackDCacheAll(void);
|
||||
|
||||
|
||||
#endif /* defined(_LANGUAGE_C) || defined(_LANGUAGE_C_PLUS_PLUS) */
|
||||
#endif /* defined(_LANGUAGE_C) || defined(_LANGUAGE_C_PLUS_PLUS) */
|
||||
|
||||
#ifdef _LANGUAGE_C_PLUS_PLUS
|
||||
}
|
||||
|
||||
@@ -21,14 +21,14 @@
|
||||
|
||||
/*---------------------------------------------------------------------*
|
||||
Copyright (C) 1998 Nintendo. (Originated by SGI)
|
||||
|
||||
|
||||
$RCSfile: os_cont.h,v $
|
||||
$Revision: 1.1 $
|
||||
$Date: 1998/10/09 08:01:05 $
|
||||
*---------------------------------------------------------------------*/
|
||||
|
||||
#ifndef _OS_CONT_H_
|
||||
#define _OS_CONT_H_
|
||||
#define _OS_CONT_H_
|
||||
|
||||
#ifdef _LANGUAGE_C_PLUS_PLUS
|
||||
extern "C" {
|
||||
@@ -37,7 +37,6 @@ extern "C" {
|
||||
#include <PR/ultratypes.h>
|
||||
#include "os_message.h"
|
||||
|
||||
|
||||
#if defined(_LANGUAGE_C) || defined(_LANGUAGE_C_PLUS_PLUS)
|
||||
|
||||
/**************************************************************************
|
||||
@@ -47,31 +46,30 @@ extern "C" {
|
||||
*/
|
||||
|
||||
/*
|
||||
* Structure for controllers
|
||||
* Structure for controllers
|
||||
*/
|
||||
|
||||
typedef struct {
|
||||
u16 type; /* Controller Type */
|
||||
u8 status; /* Controller status */
|
||||
u8 errno;
|
||||
}OSContStatus;
|
||||
u16 type; /* Controller Type */
|
||||
u8 status; /* Controller status */
|
||||
u8 errno;
|
||||
} OSContStatus;
|
||||
|
||||
typedef struct {
|
||||
u16 button;
|
||||
s8 stick_x; /* -80 <= stick_x <= 80 */
|
||||
s8 stick_y; /* -80 <= stick_y <= 80 */
|
||||
u8 errno;
|
||||
u16 button;
|
||||
s8 stick_x; /* -80 <= stick_x <= 80 */
|
||||
s8 stick_y; /* -80 <= stick_y <= 80 */
|
||||
u8 errno;
|
||||
} OSContPad;
|
||||
|
||||
typedef struct {
|
||||
void *address; /* Ram pad Address: 11 bits */
|
||||
u8 databuffer[32]; /* address of the data buffer */
|
||||
u8 addressCrc; /* CRC code for address */
|
||||
u8 dataCrc; /* CRC code for data */
|
||||
u8 errno;
|
||||
void* address; /* Ram pad Address: 11 bits */
|
||||
u8 databuffer[32]; /* address of the data buffer */
|
||||
u8 addressCrc; /* CRC code for address */
|
||||
u8 dataCrc; /* CRC code for data */
|
||||
u8 errno;
|
||||
} OSContRamIo;
|
||||
|
||||
|
||||
#endif /* defined(_LANGUAGE_C) || defined(_LANGUAGE_C_PLUS_PLUS) */
|
||||
|
||||
/**************************************************************************
|
||||
@@ -85,84 +83,83 @@ typedef struct {
|
||||
*/
|
||||
|
||||
#ifndef _HW_VERSION_1
|
||||
#define MAXCONTROLLERS 4
|
||||
#define MAXCONTROLLERS 4
|
||||
#else
|
||||
#define MAXCONTROLLERS 6
|
||||
#define MAXCONTROLLERS 6
|
||||
#endif
|
||||
|
||||
/* controller errors */
|
||||
#define CONT_NO_RESPONSE_ERROR 0x8
|
||||
#define CONT_OVERRUN_ERROR 0x4
|
||||
#define CONT_RANGE_ERROR -1
|
||||
#define CONT_NO_RESPONSE_ERROR 0x8
|
||||
#define CONT_OVERRUN_ERROR 0x4
|
||||
#define CONT_RANGE_ERROR -1
|
||||
#ifdef _HW_VERSION_1
|
||||
#define CONT_FRAME_ERROR 0x2
|
||||
#define CONT_COLLISION_ERROR 0x1
|
||||
#endif
|
||||
#define CONT_FRAME_ERROR 0x2
|
||||
#define CONT_COLLISION_ERROR 0x1
|
||||
#endif
|
||||
|
||||
/* Controller type */
|
||||
|
||||
#define CONT_ABSOLUTE 0x0001
|
||||
#define CONT_RELATIVE 0x0002
|
||||
#define CONT_JOYPORT 0x0004
|
||||
#define CONT_EEPROM 0x8000
|
||||
#define CONT_EEP16K 0x4000
|
||||
#define CONT_TYPE_MASK 0x1f07
|
||||
#define CONT_TYPE_NORMAL 0x0005
|
||||
#define CONT_TYPE_MOUSE 0x0002
|
||||
#define CONT_TYPE_VOICE 0x0100
|
||||
#define CONT_ABSOLUTE 0x0001
|
||||
#define CONT_RELATIVE 0x0002
|
||||
#define CONT_JOYPORT 0x0004
|
||||
#define CONT_EEPROM 0x8000
|
||||
#define CONT_EEP16K 0x4000
|
||||
#define CONT_TYPE_MASK 0x1f07
|
||||
#define CONT_TYPE_NORMAL 0x0005
|
||||
#define CONT_TYPE_MOUSE 0x0002
|
||||
#define CONT_TYPE_VOICE 0x0100
|
||||
|
||||
/* Controller status */
|
||||
|
||||
#define CONT_CARD_ON 0x01
|
||||
#define CONT_CARD_PULL 0x02
|
||||
#define CONT_ADDR_CRC_ER 0x04
|
||||
#define CONT_EEPROM_BUSY 0x80
|
||||
#define CONT_CARD_ON 0x01
|
||||
#define CONT_CARD_PULL 0x02
|
||||
#define CONT_ADDR_CRC_ER 0x04
|
||||
#define CONT_EEPROM_BUSY 0x80
|
||||
|
||||
/* Buttons */
|
||||
|
||||
#define CONT_A 0x8000
|
||||
#define CONT_B 0x4000
|
||||
#define CONT_G 0x2000
|
||||
#define CONT_START 0x1000
|
||||
#define CONT_UP 0x0800
|
||||
#define CONT_DOWN 0x0400
|
||||
#define CONT_LEFT 0x0200
|
||||
#define CONT_RIGHT 0x0100
|
||||
#define CONT_L 0x0020
|
||||
#define CONT_R 0x0010
|
||||
#define CONT_E 0x0008
|
||||
#define CONT_D 0x0004
|
||||
#define CONT_C 0x0002
|
||||
#define CONT_F 0x0001
|
||||
#define CONT_A 0x8000
|
||||
#define CONT_B 0x4000
|
||||
#define CONT_G 0x2000
|
||||
#define CONT_START 0x1000
|
||||
#define CONT_UP 0x0800
|
||||
#define CONT_DOWN 0x0400
|
||||
#define CONT_LEFT 0x0200
|
||||
#define CONT_RIGHT 0x0100
|
||||
#define CONT_L 0x0020
|
||||
#define CONT_R 0x0010
|
||||
#define CONT_E 0x0008
|
||||
#define CONT_D 0x0004
|
||||
#define CONT_C 0x0002
|
||||
#define CONT_F 0x0001
|
||||
|
||||
/* Nintendo's official button names */
|
||||
|
||||
#define A_BUTTON CONT_A
|
||||
#define B_BUTTON CONT_B
|
||||
#define L_TRIG CONT_L
|
||||
#define R_TRIG CONT_R
|
||||
#define Z_TRIG CONT_G
|
||||
#define START_BUTTON CONT_START
|
||||
#define U_JPAD CONT_UP
|
||||
#define L_JPAD CONT_LEFT
|
||||
#define R_JPAD CONT_RIGHT
|
||||
#define D_JPAD CONT_DOWN
|
||||
#define U_CBUTTONS CONT_E
|
||||
#define L_CBUTTONS CONT_C
|
||||
#define R_CBUTTONS CONT_F
|
||||
#define D_CBUTTONS CONT_D
|
||||
#define A_BUTTON CONT_A
|
||||
#define B_BUTTON CONT_B
|
||||
#define L_TRIG CONT_L
|
||||
#define R_TRIG CONT_R
|
||||
#define Z_TRIG CONT_G
|
||||
#define START_BUTTON CONT_START
|
||||
#define U_JPAD CONT_UP
|
||||
#define L_JPAD CONT_LEFT
|
||||
#define R_JPAD CONT_RIGHT
|
||||
#define D_JPAD CONT_DOWN
|
||||
#define U_CBUTTONS CONT_E
|
||||
#define L_CBUTTONS CONT_C
|
||||
#define R_CBUTTONS CONT_F
|
||||
#define D_CBUTTONS CONT_D
|
||||
|
||||
/* Controller error number */
|
||||
|
||||
#define CONT_ERR_NO_CONTROLLER PFS_ERR_NOPACK /* 1 */
|
||||
#define CONT_ERR_CONTRFAIL CONT_OVERRUN_ERROR /* 4 */
|
||||
#define CONT_ERR_INVALID PFS_ERR_INVALID /* 5 */
|
||||
#define CONT_ERR_DEVICE PFS_ERR_DEVICE /* 11 */
|
||||
#define CONT_ERR_NOT_READY 12
|
||||
#define CONT_ERR_VOICE_MEMORY 13
|
||||
#define CONT_ERR_VOICE_WORD 14
|
||||
#define CONT_ERR_VOICE_NO_RESPONSE 15
|
||||
|
||||
#define CONT_ERR_NO_CONTROLLER PFS_ERR_NOPACK /* 1 */
|
||||
#define CONT_ERR_CONTRFAIL CONT_OVERRUN_ERROR /* 4 */
|
||||
#define CONT_ERR_INVALID PFS_ERR_INVALID /* 5 */
|
||||
#define CONT_ERR_DEVICE PFS_ERR_DEVICE /* 11 */
|
||||
#define CONT_ERR_NOT_READY 12
|
||||
#define CONT_ERR_VOICE_MEMORY 13
|
||||
#define CONT_ERR_VOICE_WORD 14
|
||||
#define CONT_ERR_VOICE_NO_RESPONSE 15
|
||||
|
||||
#if defined(_LANGUAGE_C) || defined(_LANGUAGE_C_PLUS_PLUS)
|
||||
|
||||
@@ -172,14 +169,12 @@ typedef struct {
|
||||
*
|
||||
*/
|
||||
|
||||
|
||||
/**************************************************************************
|
||||
*
|
||||
* Extern variables
|
||||
*
|
||||
*/
|
||||
|
||||
|
||||
/**************************************************************************
|
||||
*
|
||||
* Function prototypes
|
||||
@@ -188,18 +183,17 @@ typedef struct {
|
||||
|
||||
/* Controller interface */
|
||||
|
||||
extern s32 osContInit(OSMesgQueue *, u8 *, OSContStatus *);
|
||||
extern s32 osContReset(OSMesgQueue *, OSContStatus *);
|
||||
extern s32 osContStartQuery(OSMesgQueue *);
|
||||
extern s32 osContStartReadData(OSMesgQueue *);
|
||||
extern s32 osContInit(OSMesgQueue*, u8*, OSContStatus*);
|
||||
extern s32 osContReset(OSMesgQueue*, OSContStatus*);
|
||||
extern s32 osContStartQuery(OSMesgQueue*);
|
||||
extern s32 osContStartReadData(OSMesgQueue*);
|
||||
#ifndef _HW_VERSION_1
|
||||
extern s32 osContSetCh(u8);
|
||||
extern s32 osContSetCh(u8);
|
||||
#endif
|
||||
extern void osContGetQuery(OSContStatus *);
|
||||
extern void osContGetReadData(OSContPad *);
|
||||
extern void osContGetQuery(OSContStatus*);
|
||||
extern void osContGetReadData(OSContPad*);
|
||||
|
||||
|
||||
#endif /* defined(_LANGUAGE_C) || defined(_LANGUAGE_C_PLUS_PLUS) */
|
||||
#endif /* defined(_LANGUAGE_C) || defined(_LANGUAGE_C_PLUS_PLUS) */
|
||||
|
||||
#ifdef _LANGUAGE_C_PLUS_PLUS
|
||||
}
|
||||
|
||||
@@ -21,14 +21,14 @@
|
||||
|
||||
/*---------------------------------------------------------------------*
|
||||
Copyright (C) 1998 Nintendo. (Originated by SGI)
|
||||
|
||||
|
||||
$RCSfile: os_convert.h,v $
|
||||
$Revision: 1.2 $
|
||||
$Date: 1999/04/21 02:53:11 $
|
||||
*---------------------------------------------------------------------*/
|
||||
|
||||
#ifndef _OS_CONVERT_H_
|
||||
#define _OS_CONVERT_H_
|
||||
#define _OS_CONVERT_H_
|
||||
|
||||
#ifdef _LANGUAGE_C_PLUS_PLUS
|
||||
extern "C" {
|
||||
@@ -44,7 +44,6 @@ extern "C" {
|
||||
*
|
||||
*/
|
||||
|
||||
|
||||
#endif /* defined(_LANGUAGE_C) || defined(_LANGUAGE_C_PLUS_PLUS) */
|
||||
|
||||
/**************************************************************************
|
||||
@@ -53,9 +52,8 @@ extern "C" {
|
||||
*
|
||||
*/
|
||||
|
||||
#define OS_CLOCK_RATE 62500000LL
|
||||
#define OS_CPU_COUNTER (OS_CLOCK_RATE*3/4)
|
||||
|
||||
#define OS_CLOCK_RATE 62500000LL
|
||||
#define OS_CPU_COUNTER (OS_CLOCK_RATE * 3 / 4)
|
||||
|
||||
#if defined(_LANGUAGE_C) || defined(_LANGUAGE_C_PLUS_PLUS)
|
||||
|
||||
@@ -65,23 +63,22 @@ extern "C" {
|
||||
*
|
||||
*/
|
||||
|
||||
#define OS_NSEC_TO_CYCLES(n) (((u64)(n)*(OS_CPU_COUNTER/15625000LL))/(1000000000LL/15625000LL))
|
||||
#define OS_USEC_TO_CYCLES(n) (((u64)(n)*(OS_CPU_COUNTER/15625LL))/(1000000LL/15625LL))
|
||||
#define OS_CYCLES_TO_NSEC(c) (((u64)(c)*(1000000000LL/15625000LL))/(OS_CPU_COUNTER/15625000LL))
|
||||
#define OS_CYCLES_TO_USEC(c) (((u64)(c)*(1000000LL/15625LL))/(OS_CPU_COUNTER/15625LL))
|
||||
#define OS_NSEC_TO_CYCLES(n) (((u64)(n) * (OS_CPU_COUNTER / 15625000LL)) / (1000000000LL / 15625000LL))
|
||||
#define OS_USEC_TO_CYCLES(n) (((u64)(n) * (OS_CPU_COUNTER / 15625LL)) / (1000000LL / 15625LL))
|
||||
#define OS_CYCLES_TO_NSEC(c) (((u64)(c) * (1000000000LL / 15625000LL)) / (OS_CPU_COUNTER / 15625000LL))
|
||||
#define OS_CYCLES_TO_USEC(c) (((u64)(c) * (1000000LL / 15625LL)) / (OS_CPU_COUNTER / 15625LL))
|
||||
|
||||
/* OS_K?_TO_PHYSICAL macro bug fix for CodeWarrior */
|
||||
#ifndef __MWERKS__
|
||||
#define OS_K0_TO_PHYSICAL(x) (u32)(((char *)(x)-0x80000000))
|
||||
#define OS_K1_TO_PHYSICAL(x) (u32)(((char *)(x)-0xa0000000))
|
||||
#define OS_K0_TO_PHYSICAL(x) (u32)(((char*)(x) - 0x80000000))
|
||||
#define OS_K1_TO_PHYSICAL(x) (u32)(((char*)(x) - 0xa0000000))
|
||||
#else
|
||||
#define OS_K0_TO_PHYSICAL(x) ((char *)(x)-0x80000000)
|
||||
#define OS_K1_TO_PHYSICAL(x) ((char *)(x)-0xa0000000)
|
||||
#define OS_K0_TO_PHYSICAL(x) ((char*)(x) - 0x80000000)
|
||||
#define OS_K1_TO_PHYSICAL(x) ((char*)(x) - 0xa0000000)
|
||||
#endif
|
||||
|
||||
#define OS_PHYSICAL_TO_K0(x) (void *)(((u32)(x)+0x80000000))
|
||||
#define OS_PHYSICAL_TO_K1(x) (void *)(((u32)(x)+0xa0000000))
|
||||
|
||||
#define OS_PHYSICAL_TO_K0(x) (void*)(((u32)(x) + 0x80000000))
|
||||
#define OS_PHYSICAL_TO_K1(x) (void*)(((u32)(x) + 0xa0000000))
|
||||
|
||||
/**************************************************************************
|
||||
*
|
||||
@@ -89,7 +86,6 @@ extern "C" {
|
||||
*
|
||||
*/
|
||||
|
||||
|
||||
/**************************************************************************
|
||||
*
|
||||
* Function prototypes
|
||||
@@ -98,11 +94,10 @@ extern "C" {
|
||||
|
||||
/* Address translation routines and macros */
|
||||
|
||||
extern u32 osVirtualToPhysical(void *);
|
||||
extern void * osPhysicalToVirtual(u32);
|
||||
extern u32 osVirtualToPhysical(void*);
|
||||
extern void* osPhysicalToVirtual(u32);
|
||||
|
||||
|
||||
#endif /* defined(_LANGUAGE_C) || defined(_LANGUAGE_C_PLUS_PLUS) */
|
||||
#endif /* defined(_LANGUAGE_C) || defined(_LANGUAGE_C_PLUS_PLUS) */
|
||||
|
||||
#ifdef _LANGUAGE_C_PLUS_PLUS
|
||||
}
|
||||
|
||||
@@ -21,14 +21,14 @@
|
||||
|
||||
/*---------------------------------------------------------------------*
|
||||
Copyright (C) 1998 Nintendo. (Originated by SGI)
|
||||
|
||||
|
||||
$RCSfile: os_debug.h,v $
|
||||
$Revision: 1.4 $
|
||||
$Date: 1999/06/30 03:04:08 $
|
||||
*---------------------------------------------------------------------*/
|
||||
|
||||
#ifndef _OS_DEBUG_H_
|
||||
#define _OS_DEBUG_H_
|
||||
#define _OS_DEBUG_H_
|
||||
|
||||
#ifdef _LANGUAGE_C_PLUS_PLUS
|
||||
extern "C" {
|
||||
@@ -45,16 +45,15 @@ extern "C" {
|
||||
*/
|
||||
|
||||
/*
|
||||
* Structure for Profiler
|
||||
* Structure for Profiler
|
||||
*/
|
||||
typedef struct {
|
||||
u16 *histo_base; /* histogram base */
|
||||
u32 histo_size; /* histogram size */
|
||||
u32 *text_start; /* start of text segment */
|
||||
u32 *text_end; /* end of text segment */
|
||||
u16* histo_base; /* histogram base */
|
||||
u32 histo_size; /* histogram size */
|
||||
u32* text_start; /* start of text segment */
|
||||
u32* text_end; /* end of text segment */
|
||||
} OSProf;
|
||||
|
||||
|
||||
#endif /* defined(_LANGUAGE_C) || defined(_LANGUAGE_C_PLUS_PLUS) */
|
||||
|
||||
/**************************************************************************
|
||||
@@ -66,8 +65,7 @@ typedef struct {
|
||||
/*
|
||||
* Profiler constants
|
||||
*/
|
||||
#define PROF_MIN_INTERVAL 50 /* microseconds */
|
||||
|
||||
#define PROF_MIN_INTERVAL 50 /* microseconds */
|
||||
|
||||
#if defined(_LANGUAGE_C) || defined(_LANGUAGE_C_PLUS_PLUS)
|
||||
|
||||
@@ -77,14 +75,12 @@ typedef struct {
|
||||
*
|
||||
*/
|
||||
|
||||
|
||||
/**************************************************************************
|
||||
*
|
||||
* Extern variables
|
||||
*
|
||||
*/
|
||||
|
||||
|
||||
/**************************************************************************
|
||||
*
|
||||
* Function prototypes
|
||||
@@ -93,22 +89,22 @@ typedef struct {
|
||||
|
||||
/* Profiler Interface */
|
||||
|
||||
extern void osProfileInit(OSProf *, u32 profcnt);
|
||||
extern void osProfileStart(u32);
|
||||
extern void osProfileFlush(void);
|
||||
extern void osProfileStop(void);
|
||||
extern void osProfileInit(OSProf*, u32 profcnt);
|
||||
extern void osProfileStart(u32);
|
||||
extern void osProfileFlush(void);
|
||||
extern void osProfileStop(void);
|
||||
|
||||
/* Thread Profiler Interface */
|
||||
extern void osThreadProfileClear(OSId);
|
||||
extern void osThreadProfileInit(void);
|
||||
extern void osThreadProfileStart(void);
|
||||
extern void osThreadProfileStop(void);
|
||||
extern u32 osThreadProfileReadCount(OSId);
|
||||
extern u32 osThreadProfileReadCountTh(OSThread*);
|
||||
extern OSTime osThreadProfileReadTime(OSId);
|
||||
extern OSTime osThreadProfileReadTimeTh(OSThread*);
|
||||
extern void osThreadProfileClear(OSId);
|
||||
extern void osThreadProfileInit(void);
|
||||
extern void osThreadProfileStart(void);
|
||||
extern void osThreadProfileStop(void);
|
||||
extern u32 osThreadProfileReadCount(OSId);
|
||||
extern u32 osThreadProfileReadCountTh(OSThread*);
|
||||
extern OSTime osThreadProfileReadTime(OSId);
|
||||
extern OSTime osThreadProfileReadTimeTh(OSThread*);
|
||||
|
||||
#endif /* defined(_LANGUAGE_C) || defined(_LANGUAGE_C_PLUS_PLUS) */
|
||||
#endif /* defined(_LANGUAGE_C) || defined(_LANGUAGE_C_PLUS_PLUS) */
|
||||
|
||||
#ifdef _LANGUAGE_C_PLUS_PLUS
|
||||
}
|
||||
|
||||
@@ -21,14 +21,14 @@
|
||||
|
||||
/*---------------------------------------------------------------------*
|
||||
Copyright (C) 1998 Nintendo. (Originated by SGI)
|
||||
|
||||
|
||||
$RCSfile: os_eeprom.h,v $
|
||||
$Revision: 1.1 $
|
||||
$Date: 1998/10/09 08:01:06 $
|
||||
*---------------------------------------------------------------------*/
|
||||
|
||||
#ifndef _OS_EEPROM_H_
|
||||
#define _OS_EEPROM_H_
|
||||
#define _OS_EEPROM_H_
|
||||
|
||||
#ifdef _LANGUAGE_C_PLUS_PLUS
|
||||
extern "C" {
|
||||
@@ -37,7 +37,6 @@ extern "C" {
|
||||
#include <PR/ultratypes.h>
|
||||
#include "os_message.h"
|
||||
|
||||
|
||||
#if defined(_LANGUAGE_C) || defined(_LANGUAGE_C_PLUS_PLUS)
|
||||
|
||||
/**************************************************************************
|
||||
@@ -46,7 +45,6 @@ extern "C" {
|
||||
*
|
||||
*/
|
||||
|
||||
|
||||
#endif /* defined(_LANGUAGE_C) || defined(_LANGUAGE_C_PLUS_PLUS) */
|
||||
|
||||
/**************************************************************************
|
||||
@@ -57,15 +55,14 @@ extern "C" {
|
||||
|
||||
/* EEPROM TYPE */
|
||||
|
||||
#define EEPROM_TYPE_4K 0x01
|
||||
#define EEPROM_TYPE_16K 0x02
|
||||
#define EEPROM_TYPE_4K 0x01
|
||||
#define EEPROM_TYPE_16K 0x02
|
||||
|
||||
/* definition for EEPROM */
|
||||
|
||||
#define EEPROM_MAXBLOCKS 64
|
||||
#define EEP16K_MAXBLOCKS 256
|
||||
#define EEPROM_BLOCK_SIZE 8
|
||||
|
||||
#define EEPROM_MAXBLOCKS 64
|
||||
#define EEP16K_MAXBLOCKS 256
|
||||
#define EEPROM_BLOCK_SIZE 8
|
||||
|
||||
#if defined(_LANGUAGE_C) || defined(_LANGUAGE_C_PLUS_PLUS)
|
||||
|
||||
@@ -75,14 +72,12 @@ extern "C" {
|
||||
*
|
||||
*/
|
||||
|
||||
|
||||
/**************************************************************************
|
||||
*
|
||||
* Extern variables
|
||||
*
|
||||
*/
|
||||
|
||||
|
||||
/**************************************************************************
|
||||
*
|
||||
* Function prototypes
|
||||
@@ -91,14 +86,13 @@ extern "C" {
|
||||
|
||||
/* EEPROM interface */
|
||||
|
||||
extern s32 osEepromProbe(OSMesgQueue *);
|
||||
extern s32 osEepromRead(OSMesgQueue *, u8, u8 *);
|
||||
extern s32 osEepromWrite(OSMesgQueue *, u8, u8 *);
|
||||
extern s32 osEepromLongRead(OSMesgQueue *, u8, u8 *, int);
|
||||
extern s32 osEepromLongWrite(OSMesgQueue *, u8, u8 *, int);
|
||||
extern s32 osEepromProbe(OSMesgQueue*);
|
||||
extern s32 osEepromRead(OSMesgQueue*, u8, u8*);
|
||||
extern s32 osEepromWrite(OSMesgQueue*, u8, u8*);
|
||||
extern s32 osEepromLongRead(OSMesgQueue*, u8, u8*, int);
|
||||
extern s32 osEepromLongWrite(OSMesgQueue*, u8, u8*, int);
|
||||
|
||||
|
||||
#endif /* defined(_LANGUAGE_C) || defined(_LANGUAGE_C_PLUS_PLUS) */
|
||||
#endif /* defined(_LANGUAGE_C) || defined(_LANGUAGE_C_PLUS_PLUS) */
|
||||
|
||||
#ifdef _LANGUAGE_C_PLUS_PLUS
|
||||
}
|
||||
|
||||
@@ -21,14 +21,14 @@
|
||||
|
||||
/*---------------------------------------------------------------------*
|
||||
Copyright (C) 1998 Nintendo. (Originated by SGI)
|
||||
|
||||
|
||||
$RCSfile: os_error.h,v $
|
||||
$Revision: 1.1 $
|
||||
$Date: 1998/10/09 08:01:06 $
|
||||
*---------------------------------------------------------------------*/
|
||||
|
||||
#ifndef _OS_ERROR_H_
|
||||
#define _OS_ERROR_H_
|
||||
#define _OS_ERROR_H_
|
||||
|
||||
#ifdef _LANGUAGE_C_PLUS_PLUS
|
||||
extern "C" {
|
||||
@@ -44,7 +44,6 @@ extern "C" {
|
||||
*
|
||||
*/
|
||||
|
||||
|
||||
#endif /* defined(_LANGUAGE_C) || defined(_LANGUAGE_C_PLUS_PLUS) */
|
||||
|
||||
/**************************************************************************
|
||||
@@ -53,7 +52,6 @@ extern "C" {
|
||||
*
|
||||
*/
|
||||
|
||||
|
||||
#if defined(_LANGUAGE_C) || defined(_LANGUAGE_C_PLUS_PLUS)
|
||||
|
||||
/**************************************************************************
|
||||
@@ -62,22 +60,19 @@ extern "C" {
|
||||
*
|
||||
*/
|
||||
|
||||
|
||||
/**************************************************************************
|
||||
*
|
||||
* Extern variables
|
||||
*
|
||||
*/
|
||||
|
||||
|
||||
/**************************************************************************
|
||||
*
|
||||
* Function prototypes
|
||||
*
|
||||
*/
|
||||
|
||||
|
||||
#endif /* defined(_LANGUAGE_C) || defined(_LANGUAGE_C_PLUS_PLUS) */
|
||||
#endif /* defined(_LANGUAGE_C) || defined(_LANGUAGE_C_PLUS_PLUS) */
|
||||
|
||||
#ifdef _LANGUAGE_C_PLUS_PLUS
|
||||
}
|
||||
|
||||
@@ -21,7 +21,7 @@
|
||||
|
||||
/*---------------------------------------------------------------------*
|
||||
Copyright (C) 1998 Nintendo. (Originated by SGI)
|
||||
|
||||
|
||||
$RCSfile: os_exception.h,v $
|
||||
$Revision: 1.1 $
|
||||
$Date: 1998/10/09 08:01:07 $
|
||||
@@ -45,39 +45,39 @@ typedef u32 OSHWIntr;
|
||||
|
||||
/* Flags for debugging purpose */
|
||||
|
||||
#define OS_FLAG_CPU_BREAK 1 /* Break exception has occurred */
|
||||
#define OS_FLAG_FAULT 2 /* CPU fault has occurred */
|
||||
#define OS_FLAG_CPU_BREAK 1 /* Break exception has occurred */
|
||||
#define OS_FLAG_FAULT 2 /* CPU fault has occurred */
|
||||
|
||||
/* Interrupt masks */
|
||||
|
||||
#define OS_IM_NONE 0x00000001
|
||||
#define OS_IM_RCP 0x00000401
|
||||
#define OS_IM_SW1 0x00000501
|
||||
#define OS_IM_SW2 0x00000601
|
||||
#define OS_IM_CART 0x00000c01
|
||||
#define OS_IM_PRENMI 0x00001401
|
||||
#define OS_IM_RDBWRITE 0x00002401
|
||||
#define OS_IM_RDBREAD 0x00004401
|
||||
#define OS_IM_COUNTER 0x00008401
|
||||
#define OS_IM_CPU 0x0000ff01
|
||||
#define OS_IM_SP 0x00010401
|
||||
#define OS_IM_SI 0x00020401
|
||||
#define OS_IM_AI 0x00040401
|
||||
#define OS_IM_VI 0x00080401
|
||||
#define OS_IM_PI 0x00100401
|
||||
#define OS_IM_DP 0x00200401
|
||||
#define OS_IM_ALL 0x003fff01
|
||||
#define RCP_IMASK 0x003f0000
|
||||
#define RCP_IMASKSHIFT 16
|
||||
#define OS_IM_NONE 0x00000001
|
||||
#define OS_IM_RCP 0x00000401
|
||||
#define OS_IM_SW1 0x00000501
|
||||
#define OS_IM_SW2 0x00000601
|
||||
#define OS_IM_CART 0x00000c01
|
||||
#define OS_IM_PRENMI 0x00001401
|
||||
#define OS_IM_RDBWRITE 0x00002401
|
||||
#define OS_IM_RDBREAD 0x00004401
|
||||
#define OS_IM_COUNTER 0x00008401
|
||||
#define OS_IM_CPU 0x0000ff01
|
||||
#define OS_IM_SP 0x00010401
|
||||
#define OS_IM_SI 0x00020401
|
||||
#define OS_IM_AI 0x00040401
|
||||
#define OS_IM_VI 0x00080401
|
||||
#define OS_IM_PI 0x00100401
|
||||
#define OS_IM_DP 0x00200401
|
||||
#define OS_IM_ALL 0x003fff01
|
||||
#define RCP_IMASK 0x003f0000
|
||||
#define RCP_IMASKSHIFT 16
|
||||
|
||||
#if defined(_LANGUAGE_C) || defined(_LANGUAGE_C_PLUS_PLUS)
|
||||
|
||||
/* Interrupt operations */
|
||||
|
||||
extern OSIntMask osGetIntMask(void);
|
||||
extern OSIntMask osSetIntMask(OSIntMask);
|
||||
extern OSIntMask osGetIntMask(void);
|
||||
extern OSIntMask osSetIntMask(OSIntMask);
|
||||
|
||||
#endif /* defined(_LANGUAGE_C) || defined(_LANGUAGE_C_PLUS_PLUS) */
|
||||
#endif /* defined(_LANGUAGE_C) || defined(_LANGUAGE_C_PLUS_PLUS) */
|
||||
|
||||
#ifdef _LANGUAGE_C_PLUS_PLUS
|
||||
}
|
||||
|
||||
Some files were not shown because too many files have changed in this diff Show More
Reference in New Issue
Block a user