mirror of
https://github.com/jkdansereau/goldeneye-pc-port.git
synced 2026-10-23 15:52:42 +02:00
update to current private
This commit is contained in:
1 parent
9d72238213
commit
76f3582e08
1101 files changed
+788510
-222674
No files matched your search
@@ -0,0 +1,652 @@
|
||||
/**
|
||||
* This header file contains a library of advanced C Pre-Processor (CPP) macros
|
||||
* which implement various useful functions, such as iteration, in the
|
||||
* pre-processor.
|
||||
*/
|
||||
#ifndef CPPLIB_H
|
||||
#define CPPLIB_H
|
||||
|
||||
/*#define EXPAND_EXAMPLES */
|
||||
|
||||
/**
|
||||
* Macros which expand to common values
|
||||
*/
|
||||
|
||||
#define EMPTY()
|
||||
#define COMMA() ,
|
||||
#define COMMA_IF(cond) COMMA_IF_I(cond)
|
||||
#define COMMA_IF_I(cond) IF_ELSE(cond)(COMMA)(EMPTY)()
|
||||
#define LPAREN() (
|
||||
#define RPAREN() )
|
||||
#define PLUS() +
|
||||
#define ZERO() 0
|
||||
#define ONE() 1
|
||||
|
||||
#define EXPAND(a) a
|
||||
#define EAT(x)
|
||||
#define STR(n) #n
|
||||
|
||||
|
||||
/**
|
||||
* Force the pre-processor to expand the macro a large number of times. Usage:
|
||||
*
|
||||
* EVAL(expression)
|
||||
*
|
||||
* This is useful when you have a macro which evaluates to a valid macro
|
||||
* expression which is not subsequently expanded in the same pass. A contrived,
|
||||
* but easy to understand, example of such a macro follows. Note that though
|
||||
* this example is contrived, this behaviour is abused to implement bounded
|
||||
* recursion in macros such as FOR.
|
||||
*
|
||||
* #define A(x) x+1
|
||||
* #define EMPTY
|
||||
* #define NOT_QUITE_RIGHT(x) A EMPTY (x)
|
||||
* NOT_QUITE_RIGHT(999)
|
||||
*
|
||||
* Here's what happens inside the C preprocessor:
|
||||
*
|
||||
* 1. It sees a macro "NOT_QUITE_RIGHT" and performs a single macro expansion
|
||||
* pass on its arguments. Since the argument is "999" and this isn't a macro,
|
||||
* this is a boring step resulting in no change.
|
||||
* 2. The NOT_QUITE_RIGHT macro is substituted for its definition giving "A
|
||||
* EMPTY() (x)".
|
||||
* 3. The expander moves from left-to-right trying to expand the macro:
|
||||
* The first token, A, cannot be expanded since there are no brackets
|
||||
* immediately following it. The second token EMPTY(), however, can be
|
||||
* expanded (recursively in this manner) and is replaced with "".
|
||||
* 4. Expansion continues from the start of the substituted test (which in this
|
||||
* case is just empty), and sees "(999)" but since no macro name is present,
|
||||
* nothing is done. This results in a final expansion of "A (999)".
|
||||
*
|
||||
* Unfortunately, this doesn't quite meet expectations since you may expect that
|
||||
* "A (999)" would have been expanded into "999+1". Unfortunately this requires
|
||||
* a second expansion pass but luckily we can force the macro processor to make
|
||||
* more passes by abusing the first step of macro expansion: the preprocessor
|
||||
* expands arguments in their own pass. If we define a macro which does nothing
|
||||
* except produce its arguments e.g.:
|
||||
*
|
||||
* #define PASS_THROUGH(...) __VA_ARGS__
|
||||
*
|
||||
* We can now do "PASS_THROUGH(NOT_QUITE_RIGHT(999))" causing "NOT_QUITE_RIGHT"
|
||||
* to be expanded to "A (999)", as described above, when the arguments are
|
||||
* expanded. Now when the body of PASS_THROUGH is expanded, "A (999)" gets
|
||||
* expanded to "999+1".
|
||||
*
|
||||
* The EVAL defined below is essentially equivalent to a large nesting of
|
||||
* "PASS_THROUGH(PASS_THROUGH(PASS_THROUGH(..." which results in the
|
||||
* preprocessor making a large number of expansion passes over the given
|
||||
* expression.
|
||||
*/
|
||||
#define EVAL(a) EVAL512(EVAL256(EVAL128(EVAL64(EVAL32(EVAL16(EVAL8(EVAL4(EVAL2(EVAL1(a))))))))))
|
||||
#define EVAL512(a) EVAL256(EVAL128(EVAL64(EVAL32(EVAL16(EVAL8(EVAL4(EVAL2(EVAL1(a)))))))))
|
||||
#define EVAL256(a) EVAL128(EVAL64(EVAL32(EVAL16(EVAL8(EVAL4(EVAL2(EVAL1(a))))))))
|
||||
#define EVAL128(a) EVAL64(EVAL32(EVAL16(EVAL8(EVAL4(EVAL2(EVAL1(a)))))))
|
||||
#define EVAL64(a) EVAL32(EVAL16(EVAL8(EVAL4(EVAL2(EVAL1(a))))))
|
||||
#define EVAL32(a) EVAL16(EVAL8(EVAL4(EVAL2(EVAL1(a)))))
|
||||
#define EVAL16(a) EVAL8(EVAL4(EVAL2(EVAL1(a))))
|
||||
#define EVAL8(a) EVAL4(EVAL2(EVAL1(a)))
|
||||
#define EVAL4(a) EVAL2(EVAL1(a))
|
||||
#define EVAL2(a) EVAL1(a)
|
||||
#define EVAL1(VA) IF_VA(EXPAND(DEFER(IS_PAREN)(VA)))(DEFER(EXPAND_ARGS_STACK)) VA
|
||||
|
||||
/**
|
||||
* Causes a function-style macro to require an additional pass to be expanded.
|
||||
* This is useful, for example, when trying to implement recursion since the
|
||||
* recursive step must not be expanded in a single pass as the pre-processor
|
||||
* will catch it and prevent it.
|
||||
*
|
||||
* Usage:
|
||||
*
|
||||
* DEFER(IN_NEXT_PASS)(args, to, the, macro)
|
||||
*
|
||||
* Blocking a Second time can be done with DEFER2
|
||||
*
|
||||
* Usage:
|
||||
*
|
||||
* DEFER2(IN_NEXT_NEXT_PASS)(args, to, the, macro)
|
||||
*/
|
||||
|
||||
/**
|
||||
* As with DEFER1 except here n additional passes are required for DEFERn.
|
||||
*
|
||||
* The mechanism is analogous.
|
||||
*/
|
||||
#define DEFERA1024(a) DEFERA512(DEFERA512(a))
|
||||
#define DEFERA512(a) DEFERA256(DEFERA256(a))
|
||||
#define DEFERA256(a) DEFERA128(DEFERA128(a))
|
||||
#define DEFERA128(a) DEFERA64(DEFERA64(a))
|
||||
#define DEFERA64(a) DEFERA32(DEFERA32(a))
|
||||
#define DEFERA32(a) DEFERA16(DEFERA16(a))
|
||||
#define DEFERA16(a) DEFERA8(DEFERA8(a))
|
||||
#define DEFERA8(a) DEFERA4(DEFERA4(a))
|
||||
#define DEFERA4(a) DEFERA2(DEFERA2(a))
|
||||
#define DEFERA2(a) DEFERA1(DEFERA1(a))
|
||||
#define DEFERA1(a) EMPTY a
|
||||
#define DEFERB1024(a) DEFERB512(DEFERB512(a))
|
||||
#define DEFERB512(a) DEFERB256(DEFERB256(a))
|
||||
#define DEFERB256(a) DEFERB128(DEFERB128(a))
|
||||
#define DEFERB128(a) DEFERB64(DEFERB64(a))
|
||||
#define DEFERB64(a) DEFERB32(DEFERB32(a))
|
||||
#define DEFERB32(a) DEFERB16(DEFERB16(a))
|
||||
#define DEFERB16(a) DEFERB8(DEFERB8(a))
|
||||
#define DEFERB8(a) DEFERB4(DEFERB4(a))
|
||||
#define DEFERB4(a) DEFERB2(DEFERB2(a))
|
||||
#define DEFERB2(a) DEFERB1(DEFERB1(a))
|
||||
#define DEFERB1(a) () a
|
||||
|
||||
#define DEFER1024(id) id DEFERA1024() DEFERB1024()
|
||||
#define DEFER512(id) id DEFERA512() DEFERB512()
|
||||
#define DEFER256(id) id DEFERA256() DEFERB256()
|
||||
#define DEFER128(id) id DEFERA128() DEFERB128()
|
||||
#define DEFER64(id) id DEFERA64() DEFERB64()
|
||||
#define DEFER32(id) id DEFERA32() DEFERB32()
|
||||
#define DEFER16(id) id DEFERA16() DEFERB16()
|
||||
#define DEFER8(id) id DEFERA8() DEFERB8()
|
||||
#define DEFER4(id) id DEFERA4() DEFERB4()
|
||||
#define DEFER3(id) id DEFERA1() DEFERA2() DEFERB2() DEFERB1()
|
||||
#define DEFER2(id) id DEFERA2() DEFERB2()
|
||||
#define DEFER1(id) id DEFERA1() DEFERB1()
|
||||
#define DEFER(id) id DEFERA1() DEFERB1()
|
||||
|
||||
#define INC(x) CAT(INC_, x)
|
||||
#define INC_0 1
|
||||
#define INC_1 2
|
||||
#define INC_2 3
|
||||
#define INC_3 4
|
||||
#define INC_4 5
|
||||
#define INC_5 6
|
||||
#define INC_6 7
|
||||
#define INC_7 8
|
||||
#define INC_8 9
|
||||
#define INC_9 0
|
||||
|
||||
#define DEC(x) CAT(DEC_, x)
|
||||
#define DEC_0 (1/0)
|
||||
#define DEC_1 0
|
||||
#define DEC_2 1
|
||||
#define DEC_3 2
|
||||
#define DEC_4 3
|
||||
#define DEC_5 4
|
||||
#define DEC_6 5
|
||||
#define DEC_7 6
|
||||
#define DEC_8 7
|
||||
#define DEC_9 8
|
||||
|
||||
/**
|
||||
* Indirection around the standard ## concatenation operator. This simply
|
||||
* ensures that the arguments are expanded (once) before concatenation.
|
||||
* @param a, b
|
||||
* @return Concantinated Token
|
||||
*/
|
||||
#define CAT(a, b) PRIMITIVECAT(a, b)
|
||||
#define PRIMITIVECAT(a, b) a##b
|
||||
|
||||
/**
|
||||
* Get the first argument and ignore the rest.
|
||||
*/
|
||||
#define FIRST_PRE_VA(a) a
|
||||
|
||||
/**
|
||||
* Get the second argument and ignore the rest.
|
||||
*/
|
||||
#define SECOND_PRE_VA(a, b) b
|
||||
|
||||
/**
|
||||
* Expects a single input (not containing commas). Returns 1 if the input is
|
||||
* PROBE() and otherwise returns 0.
|
||||
*
|
||||
* This can be useful as the basis of a NOT function.
|
||||
*
|
||||
* This macro abuses the fact that PROBE() contains a comma while other valid
|
||||
* inputs must not.
|
||||
*/
|
||||
#define IS_PROBE(a) SECOND_PRE_VA(a, 0)
|
||||
#define PROBE() ~, 1
|
||||
|
||||
/**
|
||||
* Detect Parenthesis
|
||||
* @return TRUE/FALSE
|
||||
*/
|
||||
#define IS_PAREN(x) IS_PROBE(IS_PAREN_PROBE x)
|
||||
#define IS_PAREN_PROBE(A) PROBE(~)
|
||||
|
||||
#ifdef EXPAND_EXAMPLES
|
||||
IS_PAREN((S)) // Expands to 1
|
||||
IS_PAREN(xxx) // Expands to 0
|
||||
#endif
|
||||
|
||||
/**
|
||||
* Detects if arg or macro is defined as nothing.
|
||||
*/
|
||||
#define IS_EMPTY(x) _IS_EMPTY(x)
|
||||
#define _IS_EMPTY(x) IS_PROBE(CAT(_IS_EMPTY, _##x##_))
|
||||
#define _IS_EMPTY__ PROBE(~) /*NULL*/
|
||||
|
||||
/**
|
||||
* Detects if arg or macro is a Bool (1 or 0).
|
||||
* Use _IS_BOOL to prevent first expansion (TRUE/FALSE macro)
|
||||
* @return TRUE/FALSE
|
||||
*/
|
||||
#define IS_BOOL(x) _IS_BOOL(x)
|
||||
#define _IS_BOOL(x) IS_PROBE(CAT(_IS_BOOL, _##x##_))
|
||||
#define _IS_BOOL_TRUE_ PROBE(~)
|
||||
#define _IS_BOOL_FALSE_ PROBE(~)
|
||||
#define _IS_BOOL_1_ PROBE(~)
|
||||
#define _IS_BOOL_0_ PROBE(~)
|
||||
|
||||
/**
|
||||
* Macro version of "defined" however its limited to 1/0/nothing. Any other value
|
||||
* is indistuiguishable from a random name
|
||||
* Certain pre-defined definitions can be "NOTDEFINED" eg THIS.
|
||||
* so checking IF(DEFINED(THIS)) is asking if THIS is NOT defined
|
||||
* @return TRUE/FALSE
|
||||
*/
|
||||
#define DEFINED(x) _DEFINED(x)
|
||||
#define _DEFINED(x) IS_PROBE(CAT(_DEFINED, _##x##_))
|
||||
#define _DEFINED_0_ PROBE(~)
|
||||
#define _DEFINED_1_ PROBE(~)
|
||||
#define _DEFINED__ PROBE(~)
|
||||
|
||||
/*The following names are NOT defined and need to be regarded as NOTDEFINED */
|
||||
#define _DEFINED_THIS_ PROBE(~)
|
||||
#define _DEFINED_SETUPSUBROUTINES(ID) PROBE(~),
|
||||
|
||||
/**
|
||||
* Logical negation. 0 or nothing is defined as false and everything else as
|
||||
* true.
|
||||
*
|
||||
* When 0, _NOT_0 will be found which evaluates to the PROBE. When 1 (or any
|
||||
* other value) is given, an appropriately named macro won't be found and the
|
||||
* concatenated string will be produced. IS_PROBE then simply checks to see if
|
||||
* the PROBE was returned, cleanly converting the argument into a 1 or 0.
|
||||
* @return TRUE/FALSE
|
||||
*/
|
||||
#define NOT(x) _NOT(x)
|
||||
#define _NOT(x) IS_PROBE(CAT(_NOT, _##x##_))
|
||||
#define _NOT_0_ PROBE(~)
|
||||
#define _NOT__ PROBE(~) /*NULL*/
|
||||
|
||||
|
||||
#ifdef EXPAND_EXAMPLES
|
||||
NOT(1) // not 1
|
||||
NOT(0) // not 0
|
||||
NOT() // not
|
||||
NOT(NOT(IS_PAREN(()))) // not !1
|
||||
NOT(NOT(0)) // not !0
|
||||
NOT(NOT()) // not !
|
||||
#endif
|
||||
|
||||
/**
|
||||
* Macro version of C's famous "cast to bool" operator (i.e. !!) which takes
|
||||
* anything and casts it to 0 if it is 0 and 1 otherwise.
|
||||
* @return TRUE/FALSE
|
||||
*/
|
||||
#define BOOL(x) NOT(NOT(x))
|
||||
|
||||
/* this little anoying block may look out of place, but it needs to be right here */
|
||||
|
||||
/**
|
||||
If Statement (Non-Expanding)
|
||||
@param c: If True, output the contents of parenthises else output nothing.
|
||||
*/
|
||||
#define IF_VA(c) _IF_VA(BOOL(c))
|
||||
#define _IF_VA(c) CAT(_IF_VA_, c)
|
||||
#define _IF_VA_1(a) a
|
||||
#define _IF_VA_0(a)
|
||||
|
||||
/**
|
||||
* _VA_ARGS_ for c89
|
||||
* Allows up to 32 Args on the stack
|
||||
*/
|
||||
#define EXPAND_ARGS_STACK(A,B,C,D,E,F,G,H,I,J,K,L,M,N,O,P,Q,R,S,T,U,V,W,X,Y,Z,AA,AB,AC,AD,AE,AF,ERROR) \
|
||||
IF_VA(NOT(IS_EMPTY(A)))/*
|
||||
*/(/*
|
||||
*/A /*
|
||||
*/IF_VA(NOT(IS_EMPTY(B)))/*
|
||||
*/(/*
|
||||
*/COMMA() B /*
|
||||
*/IF_VA(NOT(IS_EMPTY(C)))/*
|
||||
*/(/*
|
||||
*/COMMA() C /*
|
||||
*/IF_VA(NOT(IS_EMPTY(D)))/*
|
||||
*/(/*
|
||||
*/COMMA() D /*
|
||||
*/IF_VA(NOT(IS_EMPTY(E)))/*
|
||||
*/(/*
|
||||
*/COMMA() E/*
|
||||
*/IF_VA(NOT(IS_EMPTY(F)))/*
|
||||
*/(/*
|
||||
*/COMMA() F /*
|
||||
*/IF_VA(NOT(IS_EMPTY(G)))/*
|
||||
*/(/*
|
||||
*/COMMA() G /*
|
||||
*/IF_VA(NOT(IS_EMPTY(H)))/*
|
||||
*/(/*
|
||||
*/COMMA() H /*
|
||||
*/IF_VA(NOT(IS_EMPTY(I)))/*
|
||||
*/(/*
|
||||
*/COMMA() I /*
|
||||
*/IF_VA(NOT(IS_EMPTY(J)))/*
|
||||
*/(/*
|
||||
*/COMMA() J /*
|
||||
*/IF_VA(NOT(IS_EMPTY(K)))/*
|
||||
*/(/*
|
||||
*/COMMA() K /*
|
||||
*/IF_VA(NOT(IS_EMPTY(L)))/*
|
||||
*/(/*
|
||||
*/COMMA() L /*
|
||||
*/IF_VA(NOT(IS_EMPTY(M)))/*
|
||||
*/(/*
|
||||
*/COMMA() M /*
|
||||
*/IF_VA(NOT(IS_EMPTY(N)))/*
|
||||
*/(/*
|
||||
*/COMMA() N /*
|
||||
*/IF_VA(NOT(IS_EMPTY(O)))/*
|
||||
*/(/*
|
||||
*/COMMA() O /*
|
||||
*/IF_VA(NOT(IS_EMPTY(P)))/*
|
||||
*/(/*
|
||||
*/COMMA() P /*
|
||||
*/IF_VA(NOT(IS_EMPTY(Q)))/*
|
||||
*/(/*
|
||||
*/COMMA() Q /*
|
||||
*/IF_VA(NOT(IS_EMPTY(R)))/*
|
||||
*/(/*
|
||||
*/COMMA() R /*
|
||||
*/IF_VA(NOT(IS_EMPTY(S)))/*
|
||||
*/(/*
|
||||
*/COMMA() S /*
|
||||
*/IF_VA(NOT(IS_EMPTY(T)))/*
|
||||
*/(/*
|
||||
*/COMMA() T /*
|
||||
*/IF_VA(NOT(IS_EMPTY(U)))/*
|
||||
*/(/*
|
||||
*/COMMA() U /*
|
||||
*/IF_VA(NOT(IS_EMPTY(V)))/*
|
||||
*/(/*
|
||||
*/COMMA() V /*
|
||||
*/IF_VA(NOT(IS_EMPTY(W)))/*
|
||||
*/(/*
|
||||
*/COMMA() W /*
|
||||
*/IF_VA(NOT(IS_EMPTY(X)))/*
|
||||
*/(/*
|
||||
*/COMMA() X /*
|
||||
*/IF_VA(NOT(IS_EMPTY(Y)))/*
|
||||
*/(/*
|
||||
*/COMMA() Y /*
|
||||
*/IF_VA(NOT(IS_EMPTY(Z)))/*
|
||||
*/(/*
|
||||
*/COMMA() Z /*
|
||||
*/IF_VA(NOT(IS_EMPTY(AA)))/*
|
||||
*/(/*
|
||||
*/COMMA() AA /*
|
||||
*/IF_VA(NOT(IS_EMPTY(AB)))/*
|
||||
*/(/*
|
||||
*/COMMA() AB /*
|
||||
*/IF_VA(NOT(IS_EMPTY(AC)))/*
|
||||
*/(/*
|
||||
*/COMMA() AC /*
|
||||
*/IF_VA(NOT(IS_EMPTY(AD)))/*
|
||||
*/(/*
|
||||
*/COMMA() AD /*
|
||||
*/IF_VA(NOT(IS_EMPTY(AE)))/*
|
||||
*/(/*
|
||||
*/COMMA() AE /*
|
||||
*/IF_VA(NOT(IS_EMPTY(AF)))/*
|
||||
*/(/*
|
||||
*/COMMA() AF /*
|
||||
*/IF_VA(NOT(IS_EMPTY(ERROR)))/*
|
||||
*/(/*
|
||||
*/COMMA() undefinedlocal = 1/0 "_VA_ARGS Stack full"/*
|
||||
*/)/*
|
||||
*/) ) ) ) ) ) ) ) ) ) ) ) ) ) ) ) ) ) ) ) ) ) ) ) ) ) ) ) ) ) ) )
|
||||
/**
|
||||
* Push/Pop VA Args arrays
|
||||
*/
|
||||
#define POP_ARG(A,B,C,D,E,F,G,H,I,J,K,L,M,N,O,P,Q,R,S,T,U,V,W,X,Y,Z,AA,AB,AC,AD,AE,AF) /*
|
||||
*/(IF_VA(IS_PAREN(A))(_POP_ARG A) /*
|
||||
ELSE*/IF_VA(NOT(IS_PAREN(A)))(EXPAND_ARGS_STACK(B,C,D,E,F,G,H,I,J,K,L,M,N,O,P,Q,R,S,T,U,V,W,X,Y,Z,AA,AB,AC,AD,AE,AF)))
|
||||
#define _POP_ARG(A,B,C,D,E,F,G,H,I,J,K,L,M,N,O,P,Q,R,S,T,U,V,W,X,Y,Z,AA,AB,AC,AD,AE,AF) EXPAND_ARGS_STACK(B,C,D,E,F,G,H,I,J,K,L,M,N,O,P,Q,R,S,T,U,V,W,X,Y,Z,AA,AB,AC,AD,AE,AF)
|
||||
#define PUSH_ARG(A,B)(A, TRY_EXPAND(B))
|
||||
|
||||
/**
|
||||
* TRY Expand If Array
|
||||
*/
|
||||
#define TRY_EXPAND(c) _TRY_EXPAND(IS_PAREN(c))(c)
|
||||
#define _TRY_EXPAND(c) CAT(__TRY_EXPAND_, c)
|
||||
#define __TRY_EXPAND_1(a) EXPAND_ARGS_STACK a
|
||||
#define __TRY_EXPAND_0(a) a
|
||||
|
||||
/**
|
||||
* Get the first argument and ignore the rest.
|
||||
*/
|
||||
#define FIRST(a) EXPAND(DEFER(FIRST_PRE_VA)(TRY_EXPAND(a)))
|
||||
|
||||
/**
|
||||
* Get the second argument and ignore the rest.
|
||||
*/
|
||||
#define SECOND(a, b) EXPAND(DEFER(SECOND_PRE_VA)(TRY_EXPAND(a), b))
|
||||
|
||||
#ifdef EXPAND_EXAMPLES
|
||||
// POP ARG
|
||||
POP_ARG(THIS, IS, a, TEST, hy)
|
||||
// push arg
|
||||
PUSH_ARG(test, (this, is, a, test, with, a , is, so, is, a, test, with, a , is, so, is, a, test, with, a , is, so, is, a, test, with, a , is, so))
|
||||
#endif
|
||||
|
||||
/**
|
||||
* Logical OR. Simply performs a lookup.
|
||||
*/
|
||||
#define OR(a, b) CAT(CAT(_OR_, a), b)
|
||||
#define _OR_00 0
|
||||
#define _OR_01 1
|
||||
#define _OR_10 1
|
||||
#define _OR_11 1
|
||||
/**
|
||||
* Logical XOR. Simply performs a lookup.
|
||||
*/
|
||||
#define XOR(a, b) CAT(CAT(_XOR_, a), b)
|
||||
#define _XOR_00 0
|
||||
#define _XOR_01 1
|
||||
#define _XOR_10 1
|
||||
#define _XOR_11 0
|
||||
/**
|
||||
* Logical AND. Simply performs a lookup.
|
||||
*/
|
||||
#define AND(a, b) CAT(CAT(_AND_, a), b)
|
||||
#define _AND_00 0
|
||||
#define _AND_01 0
|
||||
#define _AND_10 0
|
||||
#define _AND_11 1
|
||||
|
||||
/**
|
||||
* Macro if statement.
|
||||
* Usage:
|
||||
* IF(condition) \
|
||||
* ( \
|
||||
* expansion when true \
|
||||
* )
|
||||
* @param condition
|
||||
* @return TRUE/FALSE
|
||||
*/
|
||||
#define IF(c) _IF(BOOL(c))
|
||||
#define _IF(c) CAT(_IF_, c)
|
||||
#define _IF_1(a) TRY_EXPAND(a)
|
||||
#define _IF_0(a)
|
||||
|
||||
/**
|
||||
* Macro if/else statement.
|
||||
* Usage:
|
||||
*
|
||||
* IF_ELSE(condition)
|
||||
* ((
|
||||
* expansion when true
|
||||
* ))
|
||||
* ((
|
||||
* expansion when false
|
||||
* ))
|
||||
* @param condition
|
||||
* @return TRUE/FALSE
|
||||
*/
|
||||
#define IF_ELSE(c) _IF(CAT(E, BOOL(c)))
|
||||
#define _IF_E1(a) TRY_EXPAND(a) _IF_1_ELSE
|
||||
#define _IF_E0(a) _IF_0_ELSE
|
||||
#define _IF_1_ELSE(a)
|
||||
#define _IF_0_ELSE(a) TRY_EXPAND(a)
|
||||
|
||||
|
||||
#ifdef EXPAND_EXAMPLES
|
||||
IF_ELSE(220)((it was, non - zero))(it was zero) // Expands to "non Zero"
|
||||
IF(06)(NONZERO)
|
||||
|
||||
|
||||
/*
|
||||
* When
|
||||
*/
|
||||
#define WHEN(c) IF(c)(EVAL1)(EAT)
|
||||
#endif
|
||||
/**
|
||||
* Macro which checks if it has any arguments. Returns '0' if there are no
|
||||
* arguments, '1' otherwise.
|
||||
* Limitation: HAS_ARGS(,1,2,3) returns 0 -- this check essentially only checks
|
||||
* that the first argument exists.
|
||||
* @return TRUE/FALSE
|
||||
*/
|
||||
#define HAS_ARGS(a) BOOL(EXPAND(_END_OF_ARGUMENTS_ FIRST(a)()))
|
||||
#define _END_OF_ARGUMENTS_() 0
|
||||
|
||||
/*
|
||||
for_each(v.begin(), v.end(), [](int &number)
|
||||
{
|
||||
number++;
|
||||
});
|
||||
*/
|
||||
/**
|
||||
* foreach macro
|
||||
* @param
|
||||
*/
|
||||
#define foreach(var, collection) for (var = *collection; var; var++)
|
||||
|
||||
#ifdef EXPAND_EXAMPLES
|
||||
//do I have args?
|
||||
//yes
|
||||
HAS_ARGS(a, b, c)
|
||||
HAS_ARGS((a, b, c))
|
||||
//no
|
||||
HAS_ARGS()
|
||||
HAS_ARGS(())
|
||||
HAS_ARGS(( ()))
|
||||
|
||||
# define test() Im expanded
|
||||
DEFER8(test)() EVAL1(EVAL4(DEFER4(test)()))
|
||||
|
||||
# define RECURSE(X) FIRST X DEFER(_RECURSE)()(POP_ARG X)
|
||||
# define _RECURSE() RECURSE
|
||||
// RECURSE
|
||||
EVAL16(RECURSE((this, is, a, test, WITH, MANY, ARGS)))
|
||||
#endif
|
||||
|
||||
#define COUNTPARAMS(X) \
|
||||
IF_ELSE(IS_PAREN(X)) /*
|
||||
*/( /*
|
||||
*/EVAL8(COUNTPARAMS_INNER(X, 0)) /*
|
||||
*/) /*
|
||||
*/( /*
|
||||
*/0() /*
|
||||
*/)
|
||||
#define COUNTPARAMS_INNER(X, COUNT) \
|
||||
IF_ELSE(HAS_ARGS(X))/*
|
||||
*/( /*
|
||||
*/DEFER3(_COUNTPARMS)()(POP_ARG(X), INC(COUNT))/*
|
||||
*/) /*
|
||||
*/( /*
|
||||
*/COUNT /*
|
||||
*/)
|
||||
# define _COUNTPARMS() COUNTPARAMS_INNER
|
||||
|
||||
|
||||
#ifdef EXPAND_EXAMPLES
|
||||
// COUNTPARAMS - IT WORKS!!!, THIS WILL BE GREAT FOR AI
|
||||
COUNTPARAMS(())
|
||||
COUNTPARAMS((A))
|
||||
COUNTPARAMS((A, B))
|
||||
COUNTPARAMS((A, B, C))
|
||||
COUNTPARAMS((A, B, C, D))
|
||||
COUNTPARAMS((A, B, C, D, E))
|
||||
COUNTPARAMS((A, B, C, D, E, F))
|
||||
COUNTPARAMS((A, B, C, D, E, F, G))
|
||||
COUNTPARAMS((A, B, C, D, E, F,G,H))
|
||||
COUNTPARAMS((A, B, C, D, E, F,G,H,I))
|
||||
|
||||
#enAdif
|
||||
#define LIST_TO_TUPLE(list) \
|
||||
IF_ELSE(IS_PAREN(list))\
|
||||
(\
|
||||
EVAL16((LIST_TO_TUPLE_INNER(SECOND list, FIRST list)))\
|
||||
)\
|
||||
(\
|
||||
list\
|
||||
)
|
||||
|
||||
#define LIST_TO_TUPLE_INNER(list, listb) \
|
||||
IF_ELSE(HAS_ARGS(list)) \
|
||||
(\
|
||||
EXPAND(DEFER4(_LIST_TO_TUPLE_INNER)()(TRY_EXPAND((POP_ARG list)), PUSH_ARG(FIRST list, listb)))\
|
||||
)\
|
||||
(\
|
||||
0 listb\
|
||||
)
|
||||
#define _LIST_TO_TUPLE_INNER() LIST_TO_TUPLE_INNER
|
||||
// list to tuple
|
||||
LIST_TO_TUPLE((this, (is, (a, (li8st, (lots, (of, (test, (another, )))))))))
|
||||
//SINGLE
|
||||
LIST_TO_TUPLE((this,(is)))
|
||||
|
||||
#define REPEAT(count, macro, a) \
|
||||
IF_ELSE(DEC(count)) \
|
||||
(DEFER3(REPEAT_INDIRECT)()(DEC(count), macro, a))( \
|
||||
/* Do nothing, just terminate */) DEFER(macro)(DEC(count), a)
|
||||
|
||||
#define REPEAT_INDIRECT() REPEAT
|
||||
|
||||
#ifdAef EXPAND_EXAMPLES
|
||||
// An example of using this macro
|
||||
# define M(i, _) i
|
||||
EVAL16(REPEAT(9, M, ~)) // 0 1 2 3 4 5 6 7
|
||||
#endiAf
|
||||
|
||||
#define WHILE(pred, op, a) \
|
||||
IF(pred(a)) \
|
||||
(DEFER2(WHILE_INDIRECT)()(pred, op, op(a)), POP_ARG a)
|
||||
#define WHILE_INDIRECT() WHILE
|
||||
|
||||
/**
|
||||
* Macro map/list comprehension. Usage:
|
||||
*
|
||||
* MAP(op, sep, ...)
|
||||
*
|
||||
* Produces a 'sep()'-separated list of the result of op(arg) for each arg.
|
||||
*
|
||||
* Example Usage:
|
||||
*
|
||||
* #define MAKE_HAPPY(x) happy_##x
|
||||
* #define COMMA() ,
|
||||
* MAP(MAKE_HAPPY, COMMA, 1,2,3)
|
||||
*
|
||||
* Which expands to:
|
||||
*
|
||||
* happy_1 , happy_2 , happy_3
|
||||
*/
|
||||
#define MAP(op, sep, a) \
|
||||
IF_ELSE(HAS_ARGS a) \
|
||||
(EVAL(MAP_INNER(op, sep, a)))(/* Do nothing, just terminate */)
|
||||
#define MAP_INNER(op, sep, a) \
|
||||
DEFER(op) \
|
||||
(FIRST a) IF_ELSE(DEFER(HAS_ARGS) POP_ARG a)(EXPAND EMSPTY()( \
|
||||
sep() OBSTRUCT(_MAP_INNER)()(op, sep, EXPAND(POP_ARG a))))( \
|
||||
/* Do nothing, just terminate */)
|
||||
#define _MAP_INNER() MAP_INNER
|
||||
|
||||
/*MAP(MAKE_HAPPY, COMMA, (1,2,3,A))*/
|
||||
#endif
|
||||
#endif
|
||||
@@ -0,0 +1,323 @@
|
||||
/*========================================================================
|
||||
* LibFixedPoint.h
|
||||
*
|
||||
* This library allows for complex fixed point math.
|
||||
* it has greater flexibility than the gu functions (which are 32bit)
|
||||
*
|
||||
* example:
|
||||
* FTOFIX32(100.5)
|
||||
* will result in 6586368 (or 0x0064 8000) which is a s15.16 fixed format.
|
||||
*
|
||||
* #define fixed_fmt_z s16, 13, 2
|
||||
* fixed(fixed_fmt_z) z;
|
||||
* z.full = Float2Fixed(z, 7.3);
|
||||
*
|
||||
* will result in 402 (or 0x0192) which is s13.2 (as defined)
|
||||
*
|
||||
*========================================================================*/
|
||||
/**************************************************************************
|
||||
*
|
||||
* $REVISION: 1.0 $
|
||||
* $DATE: 2021/03/09 02:03:28 $
|
||||
* $SOURCE: /include/LibFixedPoint.h,v $
|
||||
*
|
||||
**************************************************************************/
|
||||
#ifndef _LIBFIXEDPOINT_H_
|
||||
# define _LIBFIXEDPOINT_H_
|
||||
#include <CPPLib.h>
|
||||
#include <ultra64.h>
|
||||
|
||||
|
||||
|
||||
|
||||
#pragma region Private Implementation Macros
|
||||
|
||||
#define _fixed(TYPE, INTEGER, FRACTION) \
|
||||
union \
|
||||
{ \
|
||||
TYPE full; \
|
||||
struct \
|
||||
{ \
|
||||
TYPE integer : INTEGER; \
|
||||
TYPE fraction : FRACTION; \
|
||||
} part; \
|
||||
}
|
||||
|
||||
#define _Float2Fixed(SIZE, INTEGER, FRACTION, VALUE) ((VALUE) * (1 << FRACTION))
|
||||
|
||||
#define _Fixed2Float(SIZE, INTEGER, FRACTION, VALUE) \
|
||||
((float)(VALUE) / (1 << FRACTION))
|
||||
|
||||
#define _GetFixedFraction(SIZE, INTEGER, FRACTION, VALUE) \
|
||||
((unsigned SIZE)((1E##FRACTION) * \
|
||||
(VALUE.part.fraction & ((1 << FRACTION) - 1))) / \
|
||||
(1 << FRACTION))
|
||||
|
||||
#define _FixedAddition(SIZE_A, \
|
||||
INTEGER_A, \
|
||||
FRACTION_A, \
|
||||
VALUE_A, \
|
||||
SIZE_B, \
|
||||
INTEGER_B, \
|
||||
FRACTION_B, \
|
||||
VALUE_B) \
|
||||
(SIZE_A) VALUE_A + (VALUE_B << (FRACTION_A - FRACTION_B))
|
||||
|
||||
#define _FixedSubtraction(SIZE_A, \
|
||||
INTEGER_A, \
|
||||
FRACTION_A, \
|
||||
VALUE_A, \
|
||||
SIZE_B, \
|
||||
INTEGER_B, \
|
||||
FRACTION_B, \
|
||||
VALUE_B) \
|
||||
(SIZE_A) VALUE_A - (VALUE_B << (FRACTION_A - FRACTION_B))
|
||||
|
||||
#define _FixedMultiplication(SIZE_A, \
|
||||
INTEGER_A, \
|
||||
FRACTION_A, \
|
||||
VALUE_A, \
|
||||
SIZE_B, \
|
||||
INTEGER_B, \
|
||||
FRACTION_B, \
|
||||
VALUE_B) \
|
||||
(VALUE_A * VALUE_B) >> (FRACTION_A - FRACTION_B)
|
||||
|
||||
#define _FixedDivision(SIZE_A, \
|
||||
INTEGER_A, \
|
||||
FRACTION_A, \
|
||||
VALUE_A, \
|
||||
SIZE_B, \
|
||||
INTEGER_B, \
|
||||
FRACTION_B, \
|
||||
VALUE_B) \
|
||||
(VALUE_A << (FRACTION_A - FRACTION_B) / VALUE_B)
|
||||
|
||||
#pragma endregion
|
||||
#pragma region Public Macros
|
||||
|
||||
/**
|
||||
* Define a Fixed Point type.
|
||||
* Please Define the format Directly Before this.
|
||||
* #define fixed_fmt_VarName Size,Integer,Fraction
|
||||
* @param FORMAT: format name eg, fixed_fmt_VarName
|
||||
*/
|
||||
#define fixed(FORMAT) EXPAND(_fixed(FORMAT))
|
||||
|
||||
/**
|
||||
* Convert a float to a Fixed Point type (integer).
|
||||
* @param VAR: Variable to assign VALUE to.
|
||||
* @param VALUE: Float Value to convert.
|
||||
*/
|
||||
#define Float2Fixed(VAR, VALUE) \
|
||||
EXPAND(DEFER(_Float2Fixed)(EXPAND(fixed_fmt_##VAR), VALUE))
|
||||
|
||||
/**
|
||||
* Convert a Fixed Point type (integer) to a float.
|
||||
* @param VAR: Variable to convert.
|
||||
*/
|
||||
#define Fixed2Float(VAR) \
|
||||
EXPAND(DEFER(_Fixed2Float)(EXPAND(fixed_fmt_##VAR), VAR.full))
|
||||
|
||||
/**
|
||||
* @param VAR: Fixed Type to Read.
|
||||
* @return Scaled Integer representing the Fractional Componant. eg, 75 for 0.75
|
||||
*/
|
||||
#define GetFixedFraction(VAR) \
|
||||
EXPAND(DEFER(_GetFixedFraction)(EXPAND(fixed_fmt_##VAR), VAR))
|
||||
|
||||
/**
|
||||
* Perform Addition on 2 Fixed Types.
|
||||
* If A and B are different types, the larger should come first.
|
||||
* @param A: Fixed Type to Read.
|
||||
* @param B: Fixed Type to Read.
|
||||
* @return Integer of Fixed Type "A".
|
||||
*/
|
||||
#define FixedAddition(A, B) \
|
||||
EXPAND(DEFER(_FixedAddition)(EXPAND(fixed_fmt_##A), \
|
||||
A.full, \
|
||||
EXPAND(fixed_fmt_##B), \
|
||||
B.full))
|
||||
|
||||
/**
|
||||
* Perform Addition on A Fixed Type and Integer.
|
||||
* @param A: Fixed Type to Read.
|
||||
* @param B: Integer.
|
||||
* @return Integer of Fixed Type "A".
|
||||
*/
|
||||
#define FixedAddition_i(A, B) \
|
||||
EXPAND(DEFER(_FixedAddition)(EXPAND(fixed_fmt_##A), \
|
||||
A.full, \
|
||||
0, 0, 0, \
|
||||
B))
|
||||
|
||||
/**
|
||||
* Perform Addition on A Fixed Type and Float.
|
||||
* @param A: Fixed Type to Read.
|
||||
* @param B: Float.
|
||||
* @return Integer of Fixed Type "A".
|
||||
*/
|
||||
#define FixedAddition_f(A, B) \
|
||||
EXPAND(DEFER(_FixedAddition)( \
|
||||
EXPAND(fixed_fmt_##A), \
|
||||
A.full, \
|
||||
EXPAND(fixed_fmt_##A), \
|
||||
EXPAND(DEFER(_Float2Fixed)(EXPAND(fixed_fmt_##A), B))))
|
||||
|
||||
/**
|
||||
* Perform Subtraction on 2 Fixed Types.
|
||||
* If A and B are different types, the larger should come first.
|
||||
* @param A: Fixed Type to Read.
|
||||
* @param B: Fixed Type to Read.
|
||||
* @return Integer of Fixed Type "A".
|
||||
*/
|
||||
#define FixedSubtraction(A, B) \
|
||||
EXPAND(DEFER(_FixedSubtraction)(EXPAND(fixed_fmt_##A), \
|
||||
A.full, \
|
||||
EXPAND(fixed_fmt_##B), \
|
||||
B.full))
|
||||
|
||||
/**
|
||||
* Perform Subtraction on A Fixed Type and Integer.
|
||||
* @param A: Fixed Type to Read.
|
||||
* @param B: Integer.
|
||||
* @return Integer of Fixed Type "A".
|
||||
*/
|
||||
#define FixedSubtraction_i(A, B) \
|
||||
EXPAND(DEFER(_FixedSubtraction)(EXPAND(fixed_fmt_##A), A.full, 0, 0, 0, B))
|
||||
|
||||
/**
|
||||
* Perform Subtraction on A Fixed Type and Float.
|
||||
* @param A: Fixed Type to Read.
|
||||
* @param B: Float.
|
||||
* @return Integer of Fixed Type "A".
|
||||
*/
|
||||
#define FixedSubtraction_f(A, B) \
|
||||
EXPAND(DEFER(_FixedSubtraction)( \
|
||||
EXPAND(fixed_fmt_##A), \
|
||||
A.full, \
|
||||
EXPAND(fixed_fmt_##A), \
|
||||
EXPAND(DEFER(_Float2Fixed)(EXPAND(fixed_fmt_##A), B))))
|
||||
|
||||
/**
|
||||
* Perform Multiplication on 2 Fixed Types.
|
||||
* If A and B are different types, the larger Fractional should come first.
|
||||
* @param A: Fixed Type to Read.
|
||||
* @param B: Fixed Type to Read.
|
||||
* @return Integer with "A" bits fraction.
|
||||
*/
|
||||
#define FixedMultiplication(A, B) \
|
||||
EXPAND(DEFER(_FixedMultiplication)(EXPAND(fixed_fmt_##A), \
|
||||
A.full, \
|
||||
EXPAND(fixed_fmt_##B), \
|
||||
B.full))
|
||||
|
||||
/**
|
||||
* Perform Multiplication on A Fixed Type and Integer.
|
||||
* @param A: Fixed Type to Read.
|
||||
* @param B: Integer.
|
||||
* @return Integer of Fixed Type "A".
|
||||
*/
|
||||
#define FixedMultiplication_i(A, B) \
|
||||
EXPAND(DEFER( \
|
||||
_FixedMultiplication)(EXPAND(fixed_fmt_##A), A.full, 0, 0, 0, B))
|
||||
|
||||
/**
|
||||
* Perform Multiplication on A Fixed Type and Float.
|
||||
* @param A: Fixed Type to Read.
|
||||
* @param B: Float.
|
||||
* @return Integer of Fixed Type "A".
|
||||
*/
|
||||
#define FixedMultiplication_f(A, B) \
|
||||
EXPAND(DEFER(_FixedMultiplication)( \
|
||||
EXPAND(fixed_fmt_##A), \
|
||||
A.full, \
|
||||
EXPAND(fixed_fmt_##A), \
|
||||
EXPAND(DEFER(_Float2Fixed)(EXPAND(fixed_fmt_##A), B))))
|
||||
|
||||
/**
|
||||
* Perform Division on 2 Fixed Types.
|
||||
* If A and B are different types, the larger Fractional should come first.
|
||||
* @param A: Fixed Type to Read.
|
||||
* @param B: Fixed Type to Read.
|
||||
* @return Integer with "A" bits fraction.
|
||||
*/
|
||||
#define FixedDivision(A, B) \
|
||||
EXPAND(DEFER(_FixedDivision)(EXPAND(fixed_fmt_##A), \
|
||||
A.full, \
|
||||
EXPAND(fixed_fmt_##B), \
|
||||
B.full))
|
||||
/**
|
||||
* Perform Division on A Fixed Type and Integer.
|
||||
* @param A: Fixed Type to Read.
|
||||
* @param B: Integer.
|
||||
* @return Integer of Fixed Type "A".
|
||||
*/
|
||||
#define FixedDivision_i(A, B) \
|
||||
EXPAND(DEFER(_FixedDivision)(EXPAND(fixed_fmt_##A), A.full, 0, 0, 0, B))
|
||||
/**
|
||||
* Perform Division on A Fixed Type and Float.
|
||||
* @param A: Fixed Type to Read.
|
||||
* @param B: Float.
|
||||
* @return Integer of Fixed Type "A".
|
||||
*/
|
||||
#define FixedDivision_f(A, B) \
|
||||
EXPAND(DEFER(_FixedDivision)( \
|
||||
EXPAND(fixed_fmt_##A), \
|
||||
A.full, \
|
||||
EXPAND(fixed_fmt_##A), \
|
||||
EXPAND(DEFER(_Float2Fixed)(EXPAND(fixed_fmt_##A), B))))
|
||||
|
||||
|
||||
|
||||
|
||||
#if 0
|
||||
/**
|
||||
* Example Showing all Fixed Types and a comparison to Float.
|
||||
* Result: Use Fixed for Storage and float for runtime.
|
||||
*/
|
||||
void Example()
|
||||
{
|
||||
#define fixed_fmt_y unsigned char, 3, 1
|
||||
fixed(fixed_fmt_y) y; // 1bytes
|
||||
|
||||
#define fixed_fmt_z short, 13, 2
|
||||
fixed(fixed_fmt_z) z; // 2bytes
|
||||
|
||||
#define fixed_fmt_Result short, 14, 2
|
||||
fixed(fixed_fmt_Result) Result; // 2bytes
|
||||
|
||||
float Comparitor; // 4bytes
|
||||
Comparitor = 6.5; // 1 Instructions
|
||||
|
||||
z.full = Float2Fixed(z, 7.3);
|
||||
printf("\n Zfull = %d", z.full); // 29 1 Instructions
|
||||
printf("\n Zint = %d", z.part.integer); // 7 3 Instructions
|
||||
printf("\n Zfrac = %d", z.part.fraction); // 1 5 Instructions
|
||||
printf("\n Zfixedfulldec = %d.%u",
|
||||
z.part.integer,
|
||||
GetFixedFraction(z)); // 7, 25 41 Instructions
|
||||
printf("\n ZFixed2Float = %g", Fixed2Float(z)); // 7.25 7 Instructions
|
||||
|
||||
y.full = 4;
|
||||
printf("\n y = %g", Fixed2Float(y)); // 2
|
||||
|
||||
Result.full = FixedMultiplication(z, y); // 9 Instructions
|
||||
printf("\n Result = %g", Fixed2Float(Result)); // 14.5
|
||||
|
||||
Result.full = FixedDivision(z, y); // 9 Instructions
|
||||
printf("\n Result = %g", Fixed2Float(Result)); // 3.5
|
||||
|
||||
Result.full = FixedSubtraction(z, y); // 6 Instructions
|
||||
printf("\n Result = %g", Fixed2Float(Result)); // 5.25
|
||||
|
||||
Result.full = FixedAddition(z, y); // 6 Instructions
|
||||
printf("\n Result = %g", Fixed2Float(Result)); // 9.25
|
||||
|
||||
printf("\n Comparison = %g", Comparitor); // 6.5 3 Instructions
|
||||
Comparitor *= 2.6; // 4 Instructions
|
||||
printf("\n Comparison = %g", Comparitor); // 16.9
|
||||
}
|
||||
#endif
|
||||
#pragma endregion
|
||||
#endif
|
||||
+232
-666
File diff suppressed because it is too large.
Load diff
+265
-24
@@ -1,29 +1,270 @@
|
||||
#ifndef _ULTRA64_GU_H_
|
||||
#define _ULTRA64_GU_H_
|
||||
#ifndef _GU_H_
|
||||
#define _GU_H_
|
||||
|
||||
/**************************************************************************
|
||||
* *
|
||||
* Copyright (C) 1994, Silicon Graphics, Inc. *
|
||||
* *
|
||||
* These coded instructions, statements, and computer programs contain *
|
||||
* unpublished proprietary information of Silicon Graphics, Inc., and *
|
||||
* are protected by Federal copyright law. They may not be disclosed *
|
||||
* to third parties or copied or duplicated in any form, in whole or *
|
||||
* in part, without the prior written consent of Silicon Graphics, Inc. *
|
||||
* *
|
||||
**************************************************************************/
|
||||
|
||||
/**************************************************************************
|
||||
*
|
||||
* $Revision: 1.46 $
|
||||
* $Date: 1997/11/26 00:30:53 $
|
||||
* $Source: /disk6/Master/cvsmdev2/PR/include/gu.h,v $
|
||||
*
|
||||
**************************************************************************/
|
||||
|
||||
#include <PR/mbi.h>
|
||||
#include <PR/ultratypes.h>
|
||||
#include <PR/sptask.h>
|
||||
|
||||
#define GU_PI 3.1415926
|
||||
/* Functions */
|
||||
|
||||
void guPerspectiveF(float mf[4][4], u16 *perspNorm, float fovy, float aspect,
|
||||
float near, float far, float scale);
|
||||
void guPerspective(Mtx *m, u16 *perspNorm, float fovy, float aspect, float near,
|
||||
float far, float scale);
|
||||
void guOrtho(Mtx *m, float left, float right, float bottom, float top,
|
||||
float near, float far, float scale);
|
||||
void guTranslate(Mtx *m, float x, float y, float z);
|
||||
void guRotate(Mtx *m, float a, float x, float y, float z);
|
||||
void guScale(Mtx *m, float x, float y, float z);
|
||||
void guMtxF2L(float mf[4][4], Mtx *m);
|
||||
void guMtxIdent(Mtx *m);
|
||||
void guMtxIdentF(float mf[4][4]);
|
||||
void guMtxL2F(float mf[4][4], Mtx *m);
|
||||
void guNormalize(float *, float *, float *);
|
||||
|
||||
/* Used only in Fast3DEX2 */
|
||||
void guLookAtReflect (Mtx *m, LookAt *l, float xEye, float yEye, float zEye,
|
||||
float xAt, float yAt, float zAt,
|
||||
float xUp, float yUp, float zUp);
|
||||
#ifndef MAX
|
||||
#define MAX(a,b) (((a)>(b))?(a):(b))
|
||||
#endif
|
||||
#ifndef MIN
|
||||
#define MIN(a,b) (((a)<(b))?(a):(b))
|
||||
#endif
|
||||
|
||||
#define M_PI 3.14159265358979323846
|
||||
#define M_DTOR (3.14159265358979323846/180.0)
|
||||
|
||||
#define FTOFIX32(x) (long)((x) * (float)0x00010000)
|
||||
|
||||
// original: x * (1.0f / (float)0x00010000)
|
||||
#define FIX32TOF(x) ((float)(x) / (float)0x00010000)
|
||||
|
||||
// Modified to use double precision
|
||||
#define FTOFRAC8(x) ((int) MIN(((x) * (128.0)), 127.0) & 0xff)
|
||||
|
||||
#define FILTER_WRAP 0
|
||||
#define FILTER_CLAMP 1
|
||||
|
||||
#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;
|
||||
} Image;
|
||||
|
||||
typedef struct {
|
||||
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 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 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 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 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 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 guScaleF(float mf[4][4], 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 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);
|
||||
|
||||
/* vector utility: */
|
||||
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);
|
||||
extern int guRandom(void);
|
||||
|
||||
/*
|
||||
* Math functions
|
||||
*/
|
||||
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 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 */
|
||||
|
||||
extern void guParseRdpDL(u64 *rdp_dl, u64 nbytes, u8 flags);
|
||||
extern void guParseString(char *StringPointer, u64 nbytes);
|
||||
|
||||
/*
|
||||
* 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
|
||||
|
||||
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_HANGAFTER 64
|
||||
#define GU_PARSEGBI_NOTEXTURES 128
|
||||
*/
|
||||
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
|
||||
|
||||
typedef struct {
|
||||
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);
|
||||
|
||||
#endif /* !_GU_H_ */
|
||||
+461
-121
@@ -1,13 +1,112 @@
|
||||
#ifndef _ULTRA64_LIBAUDIO_H_
|
||||
#define _ULTRA64_LIBAUDIO_H_
|
||||
/*====================================================================
|
||||
* libaudio.h
|
||||
*
|
||||
* Copyright 1993, Silicon Graphics, Inc.
|
||||
* All Rights Reserved.
|
||||
*
|
||||
* This is UNPUBLISHED PROPRIETARY SOURCE CODE of Silicon Graphics,
|
||||
* Inc.; the contents of this file may not be disclosed to third
|
||||
* parties, copied or duplicated in any form, in whole or in part,
|
||||
* without the prior written permission of Silicon Graphics, Inc.
|
||||
*
|
||||
* RESTRICTED RIGHTS LEGEND:
|
||||
* Use, duplication or disclosure by the Government is subject to
|
||||
* restrictions as set forth in subdivision (c)(1)(ii) of the Rights
|
||||
* in Technical Data and Computer Software clause at DFARS
|
||||
* 252.227-7013, and/or in similar or successor clauses in the FAR,
|
||||
* DOD or NASA FAR Supplement. Unpublished - rights reserved under the
|
||||
* Copyright Laws of the United States.
|
||||
*====================================================================*/
|
||||
|
||||
#include "abi.h"
|
||||
/**************************************************************************
|
||||
*
|
||||
* $Revision: 1.173 $
|
||||
* $Date: 1997/12/01 12:42:21 $
|
||||
* $Source: /disk6/Master/cvsmdev2/PR/include/libaudio.h,v $
|
||||
*
|
||||
**************************************************************************/
|
||||
|
||||
#ifndef __LIB_AUDIO__
|
||||
#define __LIB_AUDIO__
|
||||
|
||||
#ifdef _LANGUAGE_C_PLUS_PLUS
|
||||
extern "C" {
|
||||
#endif
|
||||
|
||||
#include <PR/ultratypes.h>
|
||||
#include <PR/mbi.h>
|
||||
|
||||
/***********************************************************************
|
||||
* misc defines
|
||||
***********************************************************************/
|
||||
#ifndef _EMULATOR
|
||||
# ifdef AUD_PROFILE
|
||||
|
||||
#define PROFILE_AUD(num, cnt, max, min) \
|
||||
{ \
|
||||
u32 currCnt = osGetCount(); \
|
||||
currCnt -= lastCnt[cnt_index]; \
|
||||
cnt_index--; \
|
||||
cnt += currCnt; \
|
||||
num++; \
|
||||
\
|
||||
if ( currCnt > max ) max = currCnt; \
|
||||
if ( currCnt < min ) min = currCnt; \
|
||||
}
|
||||
|
||||
# endif /* AUD_PROFILE */
|
||||
#endif /* EMULATOR */
|
||||
|
||||
#ifndef NULL
|
||||
#define NULL 0
|
||||
#endif
|
||||
|
||||
#define AL_FX_BUFFER_SIZE 8192
|
||||
#define AL_FRAME_INIT -1
|
||||
#define AL_USEC_PER_FRAME 16000
|
||||
#define AL_MAX_PRIORITY 127
|
||||
#define AL_GAIN_CHANGE_TIME 1000
|
||||
|
||||
typedef s32 ALMicroTime;
|
||||
typedef u8 ALPan;
|
||||
|
||||
#define AL_PAN_CENTER 64
|
||||
#define AL_PAN_LEFT 0
|
||||
#define AL_PAN_RIGHT 127
|
||||
#define AL_VOL_FULL 127
|
||||
#define AL_KEY_MIN 0
|
||||
#define AL_KEY_MAX 127
|
||||
#define AL_DEFAULT_FXMIX 0
|
||||
#define AL_SUSTAIN 63
|
||||
|
||||
/***********************************************************************
|
||||
* Error handling
|
||||
***********************************************************************/
|
||||
|
||||
#ifdef _DEBUG
|
||||
#define ALFailIf(condition, error) \
|
||||
if (condition) { \
|
||||
__osError(error, 0); \
|
||||
return; }
|
||||
|
||||
#else
|
||||
#define ALFailIf(condition, error) \
|
||||
if (condition) { \
|
||||
return; }
|
||||
#endif
|
||||
|
||||
#ifdef _DEBUG
|
||||
#define ALFlagFailIf(condition, flag, error) \
|
||||
if (condition) { \
|
||||
if(flag) __osError(error, 0); \
|
||||
return; }
|
||||
|
||||
#else
|
||||
#define ALFlagFailIf(condition, flag, error) \
|
||||
if (condition) { \
|
||||
return; }
|
||||
#endif
|
||||
|
||||
/***********************************************************************
|
||||
* Audio Library global routines
|
||||
***********************************************************************/
|
||||
@@ -16,53 +115,59 @@ typedef struct ALLink_s {
|
||||
struct ALLink_s *prev;
|
||||
} ALLink;
|
||||
|
||||
void alUnlink(ALLink *element);
|
||||
void alLink(ALLink *element, ALLink *after);
|
||||
|
||||
typedef s32 (*ALDMAproc)(s32 addr, s32 len, void *state);
|
||||
typedef ALDMAproc (*ALDMANew)(void *state);
|
||||
|
||||
#define AL_FX_NONE 0
|
||||
#define AL_FX_SMALLROOM 1
|
||||
#define AL_FX_BIGROOM 2
|
||||
#define AL_FX_CHORUS 3
|
||||
#define AL_FX_FLANGE 4
|
||||
#define AL_FX_ECHO 5
|
||||
#define AL_FX_CUSTOM 6
|
||||
|
||||
typedef u8 ALFxId;
|
||||
typedef s32 ALMicroTime;
|
||||
void alCopy(void *src, void *dest, s32 len);
|
||||
|
||||
typedef struct {
|
||||
u8 *base;
|
||||
u8 *current;
|
||||
s32 len;
|
||||
s32 count;
|
||||
u8 *base;
|
||||
u8 *cur;
|
||||
s32 len;
|
||||
s32 count;
|
||||
} ALHeap;
|
||||
|
||||
typedef struct {
|
||||
s32 maxVVoices; /* obsolete */
|
||||
s32 maxPVoices;
|
||||
s32 maxUpdates;
|
||||
s32 maxFXbusses;
|
||||
void *dmaproc;
|
||||
ALHeap *heap;
|
||||
s32 outputRate;
|
||||
ALFxId fxType;
|
||||
s32 *params;
|
||||
} ALSynConfig;
|
||||
|
||||
#define AL_HEAP_DEBUG 1
|
||||
#define AL_HEAP_MAGIC 0x20736a73
|
||||
#define AL_HEAP_INIT 0
|
||||
|
||||
void alHeapInit(ALHeap *hp, u8 *base, s32 len);
|
||||
void *alHeapDBAlloc(u8 *file, s32 line, ALHeap *hp, s32 num, s32 size);
|
||||
s32 alHeapCheck(ALHeap *hp);
|
||||
|
||||
#ifdef DEBUG
|
||||
#ifdef _DEBUG
|
||||
#define alHeapAlloc(hp, elem ,size) alHeapDBAlloc((u8 *) __FILE__,__LINE__,(hp),(elem),(size))
|
||||
#else
|
||||
#define alHeapAlloc(hp, elem ,size) alHeapDBAlloc(0, 0,(hp),(elem),(size))
|
||||
#endif
|
||||
|
||||
/***********************************************************************
|
||||
* FX Stuff
|
||||
***********************************************************************/
|
||||
#define AL_FX_NONE 0
|
||||
#define AL_FX_SMALLROOM 1
|
||||
#define AL_FX_BIGROOM 2
|
||||
#define AL_FX_CHORUS 3
|
||||
#define AL_FX_FLANGE 4
|
||||
#define AL_FX_ECHO 5
|
||||
#define AL_FX_CUSTOM 6
|
||||
|
||||
typedef u8 ALFxId;
|
||||
typedef void *ALFxRef;
|
||||
|
||||
/***********************************************************************
|
||||
* data structures for sound banks
|
||||
***********************************************************************/
|
||||
|
||||
#define AL_BANK_VERSION 0x4231 /* 'B1' */
|
||||
|
||||
/* Possible wavetable types */
|
||||
enum {AL_ADPCM_WAVE = 0,
|
||||
AL_RAW16_WAVE};
|
||||
|
||||
typedef struct {
|
||||
s32 order;
|
||||
s32 npredictors;
|
||||
@@ -163,11 +268,41 @@ typedef struct { /* Note: sizeof won't be correct */
|
||||
|
||||
void alBnkfNew(ALBankFile *f, u8 *table);
|
||||
|
||||
/***********************************************************************
|
||||
* Sequence Files
|
||||
***********************************************************************/
|
||||
#define AL_SEQBANK_VERSION 'S1'
|
||||
|
||||
typedef struct {
|
||||
u8 *offset;
|
||||
s32 len;
|
||||
} ALSeqData;
|
||||
|
||||
typedef struct { /* Note: sizeof won't be correct */
|
||||
s16 revision; /* format revision of this file */
|
||||
s16 seqCount; /* number of sequences */
|
||||
ALSeqData seqArray[1]; /* ARRAY of sequence info */
|
||||
} ALSeqFile;
|
||||
|
||||
void alSeqFileNew(ALSeqFile *f, u8 *base);
|
||||
|
||||
/***********************************************************************
|
||||
* Synthesis driver stuff
|
||||
***********************************************************************/
|
||||
typedef ALMicroTime (*ALVoiceHandler)(void *);
|
||||
|
||||
typedef struct {
|
||||
s32 maxVVoices; /* obsolete */
|
||||
s32 maxPVoices;
|
||||
s32 maxUpdates;
|
||||
s32 maxFXbusses;
|
||||
void *dmaproc;
|
||||
ALHeap *heap;
|
||||
s32 outputRate; /* output sample rate */
|
||||
ALFxId fxType;
|
||||
s32 *params;
|
||||
} ALSynConfig;
|
||||
|
||||
typedef struct ALPlayer_s {
|
||||
struct ALPlayer_s *next;
|
||||
void *clientData; /* storage for client callback */
|
||||
@@ -187,6 +322,12 @@ typedef struct ALVoice_s {
|
||||
s16 unityPitch;
|
||||
} ALVoice;
|
||||
|
||||
typedef struct ALVoiceConfig_s {
|
||||
s16 priority; /* voice priority */
|
||||
s16 fxBus; /* bus assignment */
|
||||
u8 unityPitch; /* unity pitch flag */
|
||||
} ALVoiceConfig;
|
||||
|
||||
typedef struct {
|
||||
ALPlayer *head; /* client list head */
|
||||
ALLink pFreeList; /* list of free physical voices */
|
||||
@@ -210,6 +351,33 @@ typedef struct {
|
||||
at one time at output rate */
|
||||
} ALSynth;
|
||||
|
||||
void alSynNew(ALSynth *s, ALSynConfig *config);
|
||||
void alSynDelete(ALSynth *s);
|
||||
|
||||
void alSynAddPlayer(ALSynth *s, ALPlayer *client);
|
||||
void alSynRemovePlayer(ALSynth *s, ALPlayer *client);
|
||||
|
||||
s32 alSynAllocVoice(ALSynth *s, ALVoice *v, ALVoiceConfig *vc);
|
||||
void alSynFreeVoice(ALSynth *s, ALVoice *voice);
|
||||
|
||||
void alSynStartVoice(ALSynth *s, ALVoice *voice, ALWaveTable *w);
|
||||
void alSynStartVoiceParams(ALSynth *s, ALVoice *voice, ALWaveTable *w,
|
||||
f32 pitch, s16 vol, ALPan pan, u8 fxmix,
|
||||
ALMicroTime t);
|
||||
void alSynStopVoice(ALSynth *s, ALVoice *voice);
|
||||
|
||||
void alSynSetVol(ALSynth *s, ALVoice *v, s16 vol, ALMicroTime delta);
|
||||
void alSynSetPitch(ALSynth *s, ALVoice *voice, f32 ratio);
|
||||
void alSynSetPan(ALSynth *s, ALVoice *voice, ALPan pan);
|
||||
void alSynSetFXMix(ALSynth *s, ALVoice *voice, u8 fxmix);
|
||||
void alSynSetPriority(ALSynth *s, ALVoice *voice, s16 priority);
|
||||
s16 alSynGetPriority(ALSynth *s, ALVoice *voice);
|
||||
|
||||
ALFxRef *alSynAllocFX(ALSynth *s, s16 bus, ALSynConfig *c, ALHeap *hp);
|
||||
ALFxRef alSynGetFXRef(ALSynth *s, s16 bus, s16 index);
|
||||
void alSynFreeFX(ALSynth *s, ALFxRef *fx);
|
||||
void alSynSetFXParam(ALSynth *s, ALFxRef fx, s16 paramID, void *param);
|
||||
|
||||
/***********************************************************************
|
||||
* Audio Library (AL) stuff
|
||||
***********************************************************************/
|
||||
@@ -217,53 +385,142 @@ typedef struct {
|
||||
ALSynth drvr;
|
||||
} ALGlobals;
|
||||
|
||||
/***********************************************************************
|
||||
* Sequence Files
|
||||
***********************************************************************/
|
||||
extern ALGlobals *alGlobals;
|
||||
|
||||
/**
|
||||
* Metadata for a sequence "file" entry / data content of single sequence.
|
||||
* Based on original ALSeqData in n64devkit\ultra\usr\include\PR\libaudio.h.
|
||||
*/
|
||||
typedef struct
|
||||
{
|
||||
u8 *address;
|
||||
u16 offset;
|
||||
u16 len;
|
||||
} ALSeqData;
|
||||
void alInit(ALGlobals *glob, ALSynConfig *c);
|
||||
void alClose(ALGlobals *glob);
|
||||
|
||||
/**
|
||||
* Structure for storing collection of sequence metadatas.
|
||||
* Based on original ALSeqFile in n64devkit\ultra\usr\include\PR\libaudio.h.
|
||||
*/
|
||||
typedef struct
|
||||
{
|
||||
/**
|
||||
* number of sequences.
|
||||
*/
|
||||
u16 seqCount;
|
||||
|
||||
/**
|
||||
* Unknown, maybe revision.
|
||||
*/
|
||||
u16 unk;
|
||||
|
||||
/**
|
||||
* ARRAY of sequence info. This is a "dynamic" array, more space
|
||||
* will be allocated from ALHeap at runtime.
|
||||
*/
|
||||
ALSeqData seqArray[1];
|
||||
} ALSeqFile;
|
||||
|
||||
void alSeqFileNew(ALSeqFile *f, u8 *base);
|
||||
Acmd *alAudioFrame(Acmd *cmdList, s32 *cmdLen, s16 *outBuf, s32 outLen);
|
||||
|
||||
/***********************************************************************
|
||||
* Audio Library (AL) stuff
|
||||
* Sequence Player stuff
|
||||
***********************************************************************/
|
||||
|
||||
/*
|
||||
* Play states
|
||||
*/
|
||||
#define AL_STOPPED 0
|
||||
#define AL_PLAYING 1
|
||||
#define AL_STOPPING 2
|
||||
|
||||
#define AL_DEFAULT_PRIORITY 5
|
||||
#define AL_DEFAULT_VOICE 0
|
||||
#define AL_MAX_CHANNELS 16
|
||||
|
||||
/*
|
||||
* Audio Library event type definitions
|
||||
*/
|
||||
enum ALMsg {
|
||||
AL_SEQ_REF_EVT, /* Reference to a pending event in the sequence. */
|
||||
AL_SEQ_MIDI_EVT,
|
||||
AL_SEQP_MIDI_EVT,
|
||||
AL_TEMPO_EVT,
|
||||
AL_SEQ_END_EVT,
|
||||
AL_NOTE_END_EVT,
|
||||
AL_SEQP_ENV_EVT,
|
||||
AL_SEQP_META_EVT,
|
||||
AL_SEQP_PROG_EVT,
|
||||
AL_SEQP_API_EVT,
|
||||
AL_SEQP_VOL_EVT,
|
||||
AL_SEQP_LOOP_EVT,
|
||||
AL_SEQP_PRIORITY_EVT,
|
||||
AL_SEQP_SEQ_EVT,
|
||||
AL_SEQP_BANK_EVT,
|
||||
AL_SEQP_PLAY_EVT,
|
||||
AL_SEQP_STOP_EVT,
|
||||
AL_SEQP_STOPPING_EVT,
|
||||
AL_TRACK_END,
|
||||
AL_CSP_LOOPSTART,
|
||||
AL_CSP_LOOPEND,
|
||||
AL_CSP_NOTEOFF_EVT,
|
||||
AL_TREM_OSC_EVT,
|
||||
AL_VIB_OSC_EVT
|
||||
};
|
||||
|
||||
/*
|
||||
* Midi event definitions
|
||||
*/
|
||||
#define AL_EVTQ_END 0x7fffffff
|
||||
|
||||
enum AL_MIDIstatus {
|
||||
/* For distinguishing channel number from status */
|
||||
AL_MIDI_ChannelMask = 0x0F,
|
||||
AL_MIDI_StatusMask = 0xF0,
|
||||
|
||||
/* Channel voice messages */
|
||||
AL_MIDI_ChannelVoice = 0x80,
|
||||
AL_MIDI_NoteOff = 0x80,
|
||||
AL_MIDI_NoteOn = 0x90,
|
||||
AL_MIDI_PolyKeyPressure = 0xA0,
|
||||
AL_MIDI_ControlChange = 0xB0,
|
||||
AL_MIDI_ChannelModeSelect = 0xB0,
|
||||
AL_MIDI_ProgramChange = 0xC0,
|
||||
AL_MIDI_ChannelPressure = 0xD0,
|
||||
AL_MIDI_PitchBendChange = 0xE0,
|
||||
|
||||
/* System messages */
|
||||
AL_MIDI_SysEx = 0xF0, /* System Exclusive */
|
||||
|
||||
/* System common */
|
||||
AL_MIDI_SystemCommon = 0xF1,
|
||||
AL_MIDI_TimeCodeQuarterFrame = 0xF1,
|
||||
AL_MIDI_SongPositionPointer = 0xF2,
|
||||
AL_MIDI_SongSelect = 0xF3,
|
||||
AL_MIDI_Undefined1 = 0xF4,
|
||||
AL_MIDI_Undefined2 = 0xF5,
|
||||
AL_MIDI_TuneRequest = 0xF6,
|
||||
AL_MIDI_EOX = 0xF7, /* End of System Exclusive */
|
||||
|
||||
/* System real time */
|
||||
AL_MIDI_SystemRealTime = 0xF8,
|
||||
AL_MIDI_TimingClock = 0xF8,
|
||||
AL_MIDI_Undefined3 = 0xF9,
|
||||
AL_MIDI_Start = 0xFA,
|
||||
AL_MIDI_Continue = 0xFB,
|
||||
AL_MIDI_Stop = 0xFC,
|
||||
AL_MIDI_Undefined4 = 0xFD,
|
||||
AL_MIDI_ActiveSensing = 0xFE,
|
||||
AL_MIDI_SystemReset = 0xFF,
|
||||
AL_MIDI_Meta = 0xFF /* MIDI Files only */
|
||||
};
|
||||
|
||||
enum AL_MIDIctrl {
|
||||
AL_MIDI_VOLUME_CTRL = 0x07,
|
||||
AL_MIDI_PAN_CTRL = 0x0A,
|
||||
AL_MIDI_PRIORITY_CTRL = 0x10, /* use general purpose controller for priority */
|
||||
AL_MIDI_FX_CTRL_0 = 0x14,
|
||||
AL_MIDI_FX_CTRL_1 = 0x15,
|
||||
AL_MIDI_FX_CTRL_2 = 0x16,
|
||||
AL_MIDI_FX_CTRL_3 = 0x17,
|
||||
AL_MIDI_FX_CTRL_4 = 0x18,
|
||||
AL_MIDI_FX_CTRL_5 = 0x19,
|
||||
AL_MIDI_FX_CTRL_6 = 0x1A,
|
||||
AL_MIDI_FX_CTRL_7 = 0x1B,
|
||||
AL_MIDI_FX_CTRL_8 = 0x1C,
|
||||
AL_MIDI_FX_CTRL_9 = 0x1D,
|
||||
AL_MIDI_SUSTAIN_CTRL = 0x40,
|
||||
AL_MIDI_FX1_CTRL = 0x5B,
|
||||
AL_MIDI_FX3_CTRL = 0x5D
|
||||
};
|
||||
|
||||
enum AL_MIDImeta {
|
||||
AL_MIDI_META_TEMPO = 0x51,
|
||||
AL_MIDI_META_EOT = 0x2f
|
||||
};
|
||||
|
||||
|
||||
#define AL_CMIDI_BLOCK_CODE 0xFE
|
||||
#define AL_CMIDI_LOOPSTART_CODE 0x2E
|
||||
#define AL_CMIDI_LOOPEND_CODE 0x2D
|
||||
#define AL_CMIDI_CNTRL_LOOPSTART 102
|
||||
#define AL_CMIDI_CNTRL_LOOPEND 103
|
||||
#define AL_CMIDI_CNTRL_LOOPCOUNT_SM 104
|
||||
#define AL_CMIDI_CNTRL_LOOPCOUNT_BIG 105
|
||||
|
||||
typedef struct {
|
||||
u8 *curPtr; /* ptr to the next event */
|
||||
s32 lastTicks; /* sequence clock ticks (used by alSeqSetLoc) */
|
||||
s32 curTicks; /* sequence clock ticks of next event (used by loop end test) */
|
||||
s32 curTicks; /* sequence clock ticks of next event (used by loop end test) */
|
||||
s16 lastStatus; /* the last status msg */
|
||||
} ALSeqMarker;
|
||||
|
||||
@@ -313,16 +570,16 @@ typedef struct {
|
||||
} ALSeqpLoopEvent;
|
||||
|
||||
typedef struct {
|
||||
u8 chan;
|
||||
u8 priority;
|
||||
u8 chan;
|
||||
u8 priority;
|
||||
} ALSeqpPriorityEvent;
|
||||
|
||||
typedef struct {
|
||||
void *seq; /* pointer to a seq (could be an ALSeq or an ALCSeq). */
|
||||
void *seq; /* pointer to a seq (could be an ALSeq or an ALCSeq). */
|
||||
} ALSeqpSeqEvent;
|
||||
|
||||
typedef struct {
|
||||
ALBank *bank;
|
||||
ALBank *bank;
|
||||
} ALSeqpBankEvent;
|
||||
|
||||
typedef struct {
|
||||
@@ -332,39 +589,49 @@ typedef struct {
|
||||
} ALOscEvent;
|
||||
|
||||
typedef struct {
|
||||
s16 type;
|
||||
s16 type;
|
||||
union {
|
||||
ALMIDIEvent midi;
|
||||
ALTempoEvent tempo;
|
||||
ALEndEvent end;
|
||||
ALNoteEvent note;
|
||||
ALVolumeEvent vol;
|
||||
ALSeqpLoopEvent loop;
|
||||
ALSeqpVolEvent spvol;
|
||||
ALSeqpPriorityEvent sppriority;
|
||||
ALSeqpSeqEvent spseq;
|
||||
ALSeqpBankEvent spbank;
|
||||
ALOscEvent osc;
|
||||
ALMIDIEvent midi;
|
||||
ALTempoEvent tempo;
|
||||
ALEndEvent end;
|
||||
ALNoteEvent note;
|
||||
ALVolumeEvent vol;
|
||||
ALSeqpLoopEvent loop;
|
||||
ALSeqpVolEvent spvol;
|
||||
ALSeqpPriorityEvent sppriority;
|
||||
ALSeqpSeqEvent spseq;
|
||||
ALSeqpBankEvent spbank;
|
||||
ALOscEvent osc;
|
||||
} msg;
|
||||
} ALEvent;
|
||||
|
||||
typedef struct {
|
||||
ALLink node;
|
||||
ALMicroTime delta;
|
||||
ALEvent evt;
|
||||
} ALEventListItem;
|
||||
|
||||
typedef struct {
|
||||
ALLink freeList;
|
||||
ALLink allocList;
|
||||
s32 eventCount;
|
||||
} ALEventQueue;
|
||||
|
||||
typedef struct {
|
||||
ALInstrument *instrument; /* instrument assigned to this chan */
|
||||
s16 bendRange; /* pitch bend range in cents */
|
||||
ALFxId fxId; /* type of fx assigned to this chan */
|
||||
ALPan pan; /* overall pan for this chan */
|
||||
u8 priority; /* priority for this chan */
|
||||
u8 vol; /* current volume for this chan */
|
||||
u8 fxmix; /* current fx mix for this chan */
|
||||
u8 sustain; /* current sustain pedal state */
|
||||
f32 pitchBend; /* current pitch bend val in cents */
|
||||
} ALChanState;
|
||||
void alEvtqNew(ALEventQueue *evtq, ALEventListItem *items,
|
||||
s32 itemCount);
|
||||
ALMicroTime alEvtqNextEvent(ALEventQueue *evtq, ALEvent *evt);
|
||||
void alEvtqPostEvent(ALEventQueue *evtq, ALEvent *evt,
|
||||
ALMicroTime delta);
|
||||
void alEvtqFlush(ALEventQueue *evtq);
|
||||
void alEvtqFlushType(ALEventQueue *evtq, s16 type);
|
||||
|
||||
|
||||
#define AL_PHASE_ATTACK 0
|
||||
#define AL_PHASE_NOTEON 0
|
||||
#define AL_PHASE_DECAY 1
|
||||
#define AL_PHASE_SUSTAIN 2
|
||||
#define AL_PHASE_RELEASE 3
|
||||
#define AL_PHASE_SUSTREL 4
|
||||
|
||||
typedef struct ALVoiceState_s {
|
||||
struct ALVoiceState_s *next;/* MUST be first */
|
||||
@@ -384,6 +651,18 @@ typedef struct ALVoiceState_s {
|
||||
bit 1 vibrato flag */
|
||||
} ALVoiceState;
|
||||
|
||||
typedef struct {
|
||||
ALInstrument *instrument; /* instrument assigned to this chan */
|
||||
s16 bendRange; /* pitch bend range in cents */
|
||||
ALFxId fxId; /* type of fx assigned to this chan */
|
||||
ALPan pan; /* overall pan for this chan */
|
||||
u8 priority; /* priority for this chan */
|
||||
u8 vol; /* current volume for this chan */
|
||||
u8 fxmix; /* current fx mix for this chan */
|
||||
u8 sustain; /* current sustain pedal state */
|
||||
f32 pitchBend; /* current pitch bend val in cents */
|
||||
} ALChanState;
|
||||
|
||||
typedef struct ALSeq_s {
|
||||
u8 *base; /* ptr to start of sequence file */
|
||||
u8 *trackStart; /* ptr to first MIDI event */
|
||||
@@ -406,7 +685,7 @@ typedef struct ALCSeq_s {
|
||||
f32 qnpt; /* qrter notes / tick (1/division) */
|
||||
u32 lastTicks; /* keep track of ticks incase app wants */
|
||||
u32 lastDeltaTicks; /* number of delta ticks of last event */
|
||||
u32 deltaFlag; /* flag: set if delta's not subtracted */
|
||||
u32 deltaFlag; /* flag: set if delta's not subtracted */
|
||||
u8 *curLoc[16]; /* ptr to current track location, */
|
||||
/* may point to next event, or may point */
|
||||
/* to a backup code */
|
||||
@@ -427,7 +706,11 @@ typedef struct {
|
||||
u32 evtDeltaTicks[16];
|
||||
} ALCSeqMarker;
|
||||
|
||||
typedef struct ALSeqpConfig_s {
|
||||
#define NO_SOUND_ERR_MASK 0x01
|
||||
#define NOTE_OFF_ERR_MASK 0x02
|
||||
#define NO_VOICE_ERR_MASK 0x04
|
||||
|
||||
typedef struct {
|
||||
s32 maxVoices; /* max number of voices to alloc */
|
||||
s32 maxEvents; /* max internal events to support */
|
||||
u8 maxChannels; /* max MIDI channels to support (16)*/
|
||||
@@ -530,11 +813,11 @@ void alSeqpSetSeq(ALSeqPlayer *seqp, ALSeq *seq);
|
||||
ALSeq *alSeqpGetSeq(ALSeqPlayer *seqp);
|
||||
void alSeqpPlay(ALSeqPlayer *seqp);
|
||||
void alSeqpStop(ALSeqPlayer *seqp);
|
||||
s32 alSeqpGetState(ALSeqPlayer *seqp);
|
||||
s32 alSeqpGetState(ALSeqPlayer *seqp);
|
||||
void alSeqpSetBank(ALSeqPlayer *seqp, ALBank *b);
|
||||
void alSeqpSetTempo(ALSeqPlayer *seqp, s32 tempo);
|
||||
s32 alSeqpGetTempo(ALSeqPlayer *seqp);
|
||||
s16 alSeqpGetVol(ALSeqPlayer *seqp); /* Master volume control */
|
||||
s16 alSeqpGetVol(ALSeqPlayer *seqp); /* Master volume control */
|
||||
void alSeqpSetVol(ALSeqPlayer *seqp, s16 vol);
|
||||
void alSeqpLoop(ALSeqPlayer *seqp, ALSeqMarker *start, ALSeqMarker *end, s32 count);
|
||||
|
||||
@@ -542,8 +825,8 @@ void alSeqpSetChlProgram(ALSeqPlayer *seqp, u8 chan, u8 prog);
|
||||
s32 alSeqpGetChlProgram(ALSeqPlayer *seqp, u8 chan);
|
||||
void alSeqpSetChlFXMix(ALSeqPlayer *seqp, u8 chan, u8 fxmix);
|
||||
u8 alSeqpGetChlFXMix(ALSeqPlayer *seqp, u8 chan);
|
||||
void alSeqpSetChlVol(ALSeqPlayer *seqp, u8 chan, u8 vol);
|
||||
u8 alSeqpGetChlVol(ALSeqPlayer *seqp, u8 chan);
|
||||
void alSeqpSetChlVol(ALSeqPlayer *seqp, u8 chan, u8 vol);
|
||||
u8 alSeqpGetChlVol(ALSeqPlayer *seqp, u8 chan);
|
||||
void alSeqpSetChlPan(ALSeqPlayer *seqp, u8 chan, ALPan pan);
|
||||
ALPan alSeqpGetChlPan(ALSeqPlayer *seqp, u8 chan);
|
||||
void alSeqpSetChlPriority(ALSeqPlayer *seqp, u8 chan, u8 priority);
|
||||
@@ -552,14 +835,14 @@ void alSeqpSendMidi(ALSeqPlayer *seqp, s32 ticks, u8 status, u8 byte1, u8 byt
|
||||
|
||||
|
||||
/* Maintain backwards compatibility with old routine names. */
|
||||
#define alSeqpSetProgram alSeqpSetChlProgram
|
||||
#define alSeqpGetProgram alSeqpGetChlProgram
|
||||
#define alSeqpSetFXMix alSeqpSetChlFXMix
|
||||
#define alSeqpGetFXMix alSeqpGetChlFXMix
|
||||
#define alSeqpSetPan alSeqpSetChlPan
|
||||
#define alSeqpGetPan alSeqpGetChlPan
|
||||
#define alSeqpSetChannelPriority alSeqpSetChlPriority
|
||||
#define alSeqpGetChannelPriority alSeqpGetChlPriority
|
||||
#define alSeqpSetProgram alSeqpSetChlProgram
|
||||
#define alSeqpGetProgram alSeqpGetChlProgram
|
||||
#define alSeqpSetFXMix alSeqpSetChlFXMix
|
||||
#define alSeqpGetFXMix alSeqpGetChlFXMix
|
||||
#define alSeqpSetPan alSeqpSetChlPan
|
||||
#define alSeqpGetPan alSeqpGetChlPan
|
||||
#define alSeqpSetChannelPriority alSeqpSetChlPriority
|
||||
#define alSeqpGetChannelPriority alSeqpGetChlPriority
|
||||
|
||||
|
||||
|
||||
@@ -572,7 +855,7 @@ void alCSPSetSeq(ALCSPlayer *seqp, ALCSeq *seq);
|
||||
ALCSeq *alCSPGetSeq(ALCSPlayer *seqp);
|
||||
void alCSPPlay(ALCSPlayer *seqp);
|
||||
void alCSPStop(ALCSPlayer *seqp);
|
||||
s32 alCSPGetState(ALCSPlayer *seqp);
|
||||
s32 alCSPGetState(ALCSPlayer *seqp);
|
||||
void alCSPSetBank(ALCSPlayer *seqp, ALBank *b);
|
||||
void alCSPSetTempo(ALCSPlayer *seqp, s32 tempo);
|
||||
s32 alCSPGetTempo(ALCSPlayer *seqp);
|
||||
@@ -585,8 +868,8 @@ void alCSPSetChlFXMix(ALCSPlayer *seqp, u8 chan, u8 fxmix);
|
||||
u8 alCSPGetChlFXMix(ALCSPlayer *seqp, u8 chan);
|
||||
void alCSPSetChlPan(ALCSPlayer *seqp, u8 chan, ALPan pan);
|
||||
ALPan alCSPGetChlPan(ALCSPlayer *seqp, u8 chan);
|
||||
void alCSPSetChlVol(ALCSPlayer *seqp, u8 chan, u8 vol);
|
||||
u8 alCSPGetChlVol(ALCSPlayer *seqp, u8 chan);
|
||||
void alCSPSetChlVol(ALCSPlayer *seqp, u8 chan, u8 vol);
|
||||
u8 alCSPGetChlVol(ALCSPlayer *seqp, u8 chan);
|
||||
void alCSPSetChlPriority(ALCSPlayer *seqp, u8 chan, u8 priority);
|
||||
u8 alCSPGetChlPriority(ALCSPlayer *seqp, u8 chan);
|
||||
void alCSPSendMidi(ALCSPlayer *seqp, s32 ticks, u8 status,
|
||||
@@ -594,13 +877,70 @@ void alCSPSendMidi(ALCSPlayer *seqp, s32 ticks, u8 status,
|
||||
|
||||
|
||||
/* Maintain backwards compatibility with old routine names. */
|
||||
#define alCSPSetProgram alCSPSetChlProgram
|
||||
#define alCSPGetProgram alCSPGetChlProgram
|
||||
#define alCSPSetFXMix alCSPSetChlFXMix
|
||||
#define alCSPGetFXMix alCSPGetChlFXMix
|
||||
#define alCSPSetPan alCSPSetChlPan
|
||||
#define alCSPGetPan alCSPGetChlPan
|
||||
#define alCSPSetChannelPriority alCSPSetChlPriority
|
||||
#define alCSPGetChannelPriority alCSPGetChlPriority
|
||||
#define alCSPSetProgram alCSPSetChlProgram
|
||||
#define alCSPGetProgram alCSPGetChlProgram
|
||||
#define alCSPSetFXMix alCSPSetChlFXMix
|
||||
#define alCSPGetFXMix alCSPGetChlFXMix
|
||||
#define alCSPSetPan alCSPSetChlPan
|
||||
#define alCSPGetPan alCSPGetChlPan
|
||||
#define alCSPSetChannelPriority alCSPSetChlPriority
|
||||
#define alCSPGetChannelPriority alCSPGetChlPriority
|
||||
|
||||
|
||||
|
||||
/***********************************************************************
|
||||
* Sound Player stuff
|
||||
***********************************************************************/
|
||||
|
||||
typedef struct {
|
||||
s32 maxSounds;
|
||||
s32 maxEvents;
|
||||
ALHeap *heap;
|
||||
} ALSndpConfig;
|
||||
|
||||
typedef struct {
|
||||
ALPlayer node; /* note: must be first in structure */
|
||||
ALEventQueue evtq;
|
||||
ALEvent nextEvent;
|
||||
ALSynth *drvr; /* reference to the client driver */
|
||||
s32 target;
|
||||
void *sndState;
|
||||
s32 maxSounds;
|
||||
ALMicroTime frameTime;
|
||||
ALMicroTime nextDelta; /* microseconds to next callback */
|
||||
ALMicroTime curTime;
|
||||
} ALSndPlayer;
|
||||
|
||||
typedef s16 ALSndId;
|
||||
|
||||
void alSndpNew(ALSndPlayer *sndp, ALSndpConfig *c);
|
||||
void alSndpDelete(ALSndPlayer *sndp);
|
||||
|
||||
ALSndId alSndpAllocate(ALSndPlayer *sndp, ALSound *sound);
|
||||
void alSndpDeallocate(ALSndPlayer *sndp, ALSndId id);
|
||||
|
||||
void alSndpSetSound(ALSndPlayer *sndp, ALSndId id);
|
||||
ALSndId alSndpGetSound(ALSndPlayer *sndp);
|
||||
|
||||
void alSndpPlay(ALSndPlayer *sndp);
|
||||
void alSndpPlayAt(ALSndPlayer *sndp, ALMicroTime delta);
|
||||
void alSndpStop(ALSndPlayer *sndp);
|
||||
|
||||
void alSndpSetVol(ALSndPlayer *sndp, s16 vol);
|
||||
void alSndpSetPitch(ALSndPlayer *sndp, f32 pitch);
|
||||
void alSndpSetPan(ALSndPlayer *sndp, ALPan pan);
|
||||
void alSndpSetPriority(ALSndPlayer *sndp, ALSndId id, u8 priority);
|
||||
|
||||
void alSndpSetFXMix(ALSndPlayer *sndp, u8 mix);
|
||||
s32 alSndpGetState(ALSndPlayer *sndp);
|
||||
|
||||
#ifndef _FINALROM
|
||||
void alParseAbiCL(Acmd *cmdList, u32 nbytes);
|
||||
#endif
|
||||
#ifdef _LANGUAGE_C_PLUS_PLUS
|
||||
}
|
||||
#endif
|
||||
|
||||
#endif /* !__LIB_AUDIO__ */
|
||||
|
||||
|
||||
+1009
File diff suppressed because it is too large.
Load diff
@@ -1,92 +0,0 @@
|
||||
|
||||
/*====================================================================
|
||||
* os_ai.h
|
||||
*
|
||||
* Copyright 1995, Silicon Graphics, Inc.
|
||||
* All Rights Reserved.
|
||||
*
|
||||
* This is UNPUBLISHED PROPRIETARY SOURCE CODE of Silicon Graphics,
|
||||
* Inc.; the contents of this file may not be disclosed to third
|
||||
* parties, copied or duplicated in any form, in whole or in part,
|
||||
* without the prior written permission of Silicon Graphics, Inc.
|
||||
*
|
||||
* RESTRICTED RIGHTS LEGEND:
|
||||
* Use, duplication or disclosure by the Government is subject to
|
||||
* restrictions as set forth in subdivision (c)(1)(ii) of the Rights
|
||||
* in Technical Data and Computer Software clause at DFARS
|
||||
* 252.227-7013, and/or in similar or successor clauses in the FAR,
|
||||
* DOD or NASA FAR Supplement. Unpublished - rights reserved under the
|
||||
* Copyright Laws of the United States.
|
||||
*====================================================================*/
|
||||
|
||||
/*---------------------------------------------------------------------*
|
||||
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_
|
||||
|
||||
#ifdef _LANGUAGE_C_PLUS_PLUS
|
||||
extern "C" {
|
||||
#endif
|
||||
|
||||
#include <PR/ultratypes.h>
|
||||
|
||||
#if defined(_LANGUAGE_C) || defined(_LANGUAGE_C_PLUS_PLUS)
|
||||
|
||||
/**************************************************************************
|
||||
*
|
||||
* Type definitions
|
||||
*
|
||||
*/
|
||||
|
||||
|
||||
#endif /* defined(_LANGUAGE_C) || defined(_LANGUAGE_C_PLUS_PLUS) */
|
||||
|
||||
/**************************************************************************
|
||||
*
|
||||
* Global definitions
|
||||
*
|
||||
*/
|
||||
|
||||
|
||||
#if defined(_LANGUAGE_C) || defined(_LANGUAGE_C_PLUS_PLUS)
|
||||
|
||||
/**************************************************************************
|
||||
*
|
||||
* Macro definitions
|
||||
*
|
||||
*/
|
||||
|
||||
|
||||
/**************************************************************************
|
||||
*
|
||||
* Extern variables
|
||||
*
|
||||
*/
|
||||
|
||||
|
||||
/**************************************************************************
|
||||
*
|
||||
* Function prototypes
|
||||
*
|
||||
*/
|
||||
|
||||
/* Audio interface (Ai) */
|
||||
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) */
|
||||
|
||||
#ifdef _LANGUAGE_C_PLUS_PLUS
|
||||
}
|
||||
#endif
|
||||
|
||||
#endif /* !_OS_AI_H_ */
|
||||
@@ -1,96 +0,0 @@
|
||||
|
||||
/*====================================================================
|
||||
* os_cache.h
|
||||
*
|
||||
* Copyright 1995, Silicon Graphics, Inc.
|
||||
* All Rights Reserved.
|
||||
*
|
||||
* This is UNPUBLISHED PROPRIETARY SOURCE CODE of Silicon Graphics,
|
||||
* Inc.; the contents of this file may not be disclosed to third
|
||||
* parties, copied or duplicated in any form, in whole or in part,
|
||||
* without the prior written permission of Silicon Graphics, Inc.
|
||||
*
|
||||
* RESTRICTED RIGHTS LEGEND:
|
||||
* Use, duplication or disclosure by the Government is subject to
|
||||
* restrictions as set forth in subdivision (c)(1)(ii) of the Rights
|
||||
* in Technical Data and Computer Software clause at DFARS
|
||||
* 252.227-7013, and/or in similar or successor clauses in the FAR,
|
||||
* DOD or NASA FAR Supplement. Unpublished - rights reserved under the
|
||||
* Copyright Laws of the United States.
|
||||
*====================================================================*/
|
||||
|
||||
/*---------------------------------------------------------------------*
|
||||
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_
|
||||
|
||||
#ifdef _LANGUAGE_C_PLUS_PLUS
|
||||
extern "C" {
|
||||
#endif
|
||||
|
||||
#include <PR/ultratypes.h>
|
||||
|
||||
#if defined(_LANGUAGE_C) || defined(_LANGUAGE_C_PLUS_PLUS)
|
||||
|
||||
/**************************************************************************
|
||||
*
|
||||
* Type definitions
|
||||
*
|
||||
*/
|
||||
|
||||
|
||||
#endif /* defined(_LANGUAGE_C) || defined(_LANGUAGE_C_PLUS_PLUS) */
|
||||
|
||||
/**************************************************************************
|
||||
*
|
||||
* Global definitions
|
||||
*
|
||||
*/
|
||||
|
||||
|
||||
#if defined(_LANGUAGE_C) || defined(_LANGUAGE_C_PLUS_PLUS)
|
||||
|
||||
/**************************************************************************
|
||||
*
|
||||
* Macro definitions
|
||||
*
|
||||
*/
|
||||
|
||||
#define OS_DCACHE_ROUNDUP_ADDR(x) (void *)(((((u32)(x)+0xf)/0x10)*0x10))
|
||||
#define OS_DCACHE_ROUNDUP_SIZE(x) (u32)(((((u32)(x)+0xf)/0x10)*0x10))
|
||||
|
||||
|
||||
/**************************************************************************
|
||||
*
|
||||
* Extern variables
|
||||
*
|
||||
*/
|
||||
|
||||
|
||||
/**************************************************************************
|
||||
*
|
||||
* Function prototypes
|
||||
*
|
||||
*/
|
||||
|
||||
/* Cache operations and macros */
|
||||
|
||||
extern void osInvalDCache(void *, size_t);
|
||||
extern void osInvalICache(void *, size_t);
|
||||
extern void osWritebackDCache(void *, size_t);
|
||||
extern void osWritebackDCacheAll(void);
|
||||
|
||||
|
||||
#endif /* defined(_LANGUAGE_C) || defined(_LANGUAGE_C_PLUS_PLUS) */
|
||||
|
||||
#ifdef _LANGUAGE_C_PLUS_PLUS
|
||||
}
|
||||
#endif
|
||||
|
||||
#endif /* !_OS_CACHE_H_ */
|
||||
@@ -1,208 +0,0 @@
|
||||
|
||||
/*====================================================================
|
||||
* os_cont.h
|
||||
*
|
||||
* Copyright 1995, Silicon Graphics, Inc.
|
||||
* All Rights Reserved.
|
||||
*
|
||||
* This is UNPUBLISHED PROPRIETARY SOURCE CODE of Silicon Graphics,
|
||||
* Inc.; the contents of this file may not be disclosed to third
|
||||
* parties, copied or duplicated in any form, in whole or in part,
|
||||
* without the prior written permission of Silicon Graphics, Inc.
|
||||
*
|
||||
* RESTRICTED RIGHTS LEGEND:
|
||||
* Use, duplication or disclosure by the Government is subject to
|
||||
* restrictions as set forth in subdivision (c)(1)(ii) of the Rights
|
||||
* in Technical Data and Computer Software clause at DFARS
|
||||
* 252.227-7013, and/or in similar or successor clauses in the FAR,
|
||||
* DOD or NASA FAR Supplement. Unpublished - rights reserved under the
|
||||
* Copyright Laws of the United States.
|
||||
*====================================================================*/
|
||||
|
||||
/*---------------------------------------------------------------------*
|
||||
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_
|
||||
|
||||
#ifdef _LANGUAGE_C_PLUS_PLUS
|
||||
extern "C" {
|
||||
#endif
|
||||
|
||||
#include <PR/ultratypes.h>
|
||||
#include "os_message.h"
|
||||
|
||||
|
||||
#if defined(_LANGUAGE_C) || defined(_LANGUAGE_C_PLUS_PLUS)
|
||||
|
||||
/**************************************************************************
|
||||
*
|
||||
* Type definitions
|
||||
*
|
||||
*/
|
||||
|
||||
/*
|
||||
* Structure for controllers
|
||||
*/
|
||||
|
||||
typedef struct {
|
||||
u16 type; /* Controller Type */
|
||||
u8 status; /* Controller status */
|
||||
u8 errnum;
|
||||
}OSContStatus;
|
||||
|
||||
typedef struct {
|
||||
u16 button;
|
||||
s8 stick_x; /* -80 <= stick_x <= 80 */
|
||||
s8 stick_y; /* -80 <= stick_y <= 80 */
|
||||
u8 errnum;
|
||||
} 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 errnum;
|
||||
} OSContRamIo;
|
||||
|
||||
|
||||
#endif /* defined(_LANGUAGE_C) || defined(_LANGUAGE_C_PLUS_PLUS) */
|
||||
|
||||
/**************************************************************************
|
||||
*
|
||||
* Global definitions
|
||||
*
|
||||
*/
|
||||
|
||||
/*
|
||||
* Controllers number
|
||||
*/
|
||||
|
||||
#ifndef _HW_VERSION_1
|
||||
#define MAXCONTROLLERS 4
|
||||
#else
|
||||
#define MAXCONTROLLERS 6
|
||||
#endif
|
||||
|
||||
/* controller errors */
|
||||
#define CONT_NO_RESPONSE_ERROR 0x8
|
||||
#define CONT_OVERRUN_ERROR 0x4
|
||||
#ifdef _HW_VERSION_1
|
||||
#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
|
||||
|
||||
/* Controller status */
|
||||
|
||||
#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
|
||||
|
||||
/* 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 ANY_BUTTON 0xFFFF
|
||||
|
||||
/* 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
|
||||
|
||||
|
||||
#if defined(_LANGUAGE_C) || defined(_LANGUAGE_C_PLUS_PLUS)
|
||||
|
||||
/**************************************************************************
|
||||
*
|
||||
* Macro definitions
|
||||
*
|
||||
*/
|
||||
|
||||
|
||||
/**************************************************************************
|
||||
*
|
||||
* Extern variables
|
||||
*
|
||||
*/
|
||||
|
||||
|
||||
/**************************************************************************
|
||||
*
|
||||
* Function prototypes
|
||||
*
|
||||
*/
|
||||
|
||||
/* Controller interface */
|
||||
|
||||
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);
|
||||
#endif
|
||||
extern void osContGetQuery(OSContStatus *);
|
||||
extern void osContGetReadData(OSContPad *);
|
||||
|
||||
|
||||
#endif /* defined(_LANGUAGE_C) || defined(_LANGUAGE_C_PLUS_PLUS) */
|
||||
|
||||
#ifdef _LANGUAGE_C_PLUS_PLUS
|
||||
}
|
||||
#endif
|
||||
|
||||
#endif /* !_OS_CONT_H_ */
|
||||
@@ -1,107 +0,0 @@
|
||||
|
||||
/*====================================================================
|
||||
* os_eeprom.h
|
||||
*
|
||||
* Copyright 1995, Silicon Graphics, Inc.
|
||||
* All Rights Reserved.
|
||||
*
|
||||
* This is UNPUBLISHED PROPRIETARY SOURCE CODE of Silicon Graphics,
|
||||
* Inc.; the contents of this file may not be disclosed to third
|
||||
* parties, copied or duplicated in any form, in whole or in part,
|
||||
* without the prior written permission of Silicon Graphics, Inc.
|
||||
*
|
||||
* RESTRICTED RIGHTS LEGEND:
|
||||
* Use, duplication or disclosure by the Government is subject to
|
||||
* restrictions as set forth in subdivision (c)(1)(ii) of the Rights
|
||||
* in Technical Data and Computer Software clause at DFARS
|
||||
* 252.227-7013, and/or in similar or successor clauses in the FAR,
|
||||
* DOD or NASA FAR Supplement. Unpublished - rights reserved under the
|
||||
* Copyright Laws of the United States.
|
||||
*====================================================================*/
|
||||
|
||||
/*---------------------------------------------------------------------*
|
||||
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_
|
||||
|
||||
#ifdef _LANGUAGE_C_PLUS_PLUS
|
||||
extern "C" {
|
||||
#endif
|
||||
|
||||
#include <PR/ultratypes.h>
|
||||
#include "os_message.h"
|
||||
|
||||
|
||||
#if defined(_LANGUAGE_C) || defined(_LANGUAGE_C_PLUS_PLUS)
|
||||
|
||||
/**************************************************************************
|
||||
*
|
||||
* Type definitions
|
||||
*
|
||||
*/
|
||||
|
||||
|
||||
#endif /* defined(_LANGUAGE_C) || defined(_LANGUAGE_C_PLUS_PLUS) */
|
||||
|
||||
/**************************************************************************
|
||||
*
|
||||
* Global definitions
|
||||
*
|
||||
*/
|
||||
|
||||
/* EEPROM TYPE */
|
||||
|
||||
#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
|
||||
|
||||
|
||||
#if defined(_LANGUAGE_C) || defined(_LANGUAGE_C_PLUS_PLUS)
|
||||
|
||||
/**************************************************************************
|
||||
*
|
||||
* Macro definitions
|
||||
*
|
||||
*/
|
||||
|
||||
|
||||
/**************************************************************************
|
||||
*
|
||||
* Extern variables
|
||||
*
|
||||
*/
|
||||
|
||||
|
||||
/**************************************************************************
|
||||
*
|
||||
* Function prototypes
|
||||
*
|
||||
*/
|
||||
|
||||
/* 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);
|
||||
|
||||
|
||||
#endif /* defined(_LANGUAGE_C) || defined(_LANGUAGE_C_PLUS_PLUS) */
|
||||
|
||||
#ifdef _LANGUAGE_C_PLUS_PLUS
|
||||
}
|
||||
#endif
|
||||
|
||||
#endif /* !_OS_EEPROM_H_ */
|
||||
@@ -1,119 +0,0 @@
|
||||
|
||||
/*====================================================================
|
||||
* os_exception.h
|
||||
*
|
||||
* Copyright 1995, Silicon Graphics, Inc.
|
||||
* All Rights Reserved.
|
||||
*
|
||||
* This is UNPUBLISHED PROPRIETARY SOURCE CODE of Silicon Graphics,
|
||||
* Inc.; the contents of this file may not be disclosed to third
|
||||
* parties, copied or duplicated in any form, in whole or in part,
|
||||
* without the prior written permission of Silicon Graphics, Inc.
|
||||
*
|
||||
* RESTRICTED RIGHTS LEGEND:
|
||||
* Use, duplication or disclosure by the Government is subject to
|
||||
* restrictions as set forth in subdivision (c)(1)(ii) of the Rights
|
||||
* in Technical Data and Computer Software clause at DFARS
|
||||
* 252.227-7013, and/or in similar or successor clauses in the FAR,
|
||||
* DOD or NASA FAR Supplement. Unpublished - rights reserved under the
|
||||
* Copyright Laws of the United States.
|
||||
*====================================================================*/
|
||||
|
||||
/*---------------------------------------------------------------------*
|
||||
Copyright (C) 1998 Nintendo. (Originated by SGI)
|
||||
|
||||
$RCSfile: os_exception.h,v $
|
||||
$Revision: 1.1 $
|
||||
$Date: 1998/10/09 08:01:07 $
|
||||
*---------------------------------------------------------------------*/
|
||||
|
||||
#ifndef _OS_EXCEPTION_H_
|
||||
#define _OS_EXCEPTION_H_
|
||||
|
||||
#ifdef _LANGUAGE_C_PLUS_PLUS
|
||||
extern "C" {
|
||||
#endif
|
||||
|
||||
#include <PR/ultratypes.h>
|
||||
|
||||
#if defined(_LANGUAGE_C) || defined(_LANGUAGE_C_PLUS_PLUS)
|
||||
|
||||
/**************************************************************************
|
||||
*
|
||||
* Type definitions
|
||||
*
|
||||
*/
|
||||
|
||||
typedef u32 OSIntMask;
|
||||
typedef u32 OSHWIntr;
|
||||
|
||||
#endif /* defined(_LANGUAGE_C) || defined(_LANGUAGE_C_PLUS_PLUS) */
|
||||
|
||||
/**************************************************************************
|
||||
*
|
||||
* Global definitions
|
||||
*
|
||||
*/
|
||||
|
||||
/* Flags for debugging purpose */
|
||||
|
||||
#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_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)
|
||||
|
||||
/**************************************************************************
|
||||
*
|
||||
* Macro definitions
|
||||
*
|
||||
*/
|
||||
|
||||
|
||||
/**************************************************************************
|
||||
*
|
||||
* Extern variables
|
||||
*
|
||||
*/
|
||||
|
||||
|
||||
/**************************************************************************
|
||||
*
|
||||
* Function prototypes
|
||||
*
|
||||
*/
|
||||
|
||||
/* Interrupt operations */
|
||||
|
||||
extern OSIntMask osGetIntMask(void);
|
||||
extern OSIntMask osSetIntMask(OSIntMask);
|
||||
|
||||
|
||||
#endif /* defined(_LANGUAGE_C) || defined(_LANGUAGE_C_PLUS_PLUS) */
|
||||
|
||||
#ifdef _LANGUAGE_C_PLUS_PLUS
|
||||
}
|
||||
#endif
|
||||
|
||||
#endif /* !_OS_EXCEPTION_H_ */
|
||||
+114
-15
@@ -1,19 +1,118 @@
|
||||
#ifndef _ULTRA64_OS_INTERNAL_H_
|
||||
#define _ULTRA64_OS_INTERNAL_H_
|
||||
#include "PR/os_message.h"
|
||||
/**************************************************************************
|
||||
* *
|
||||
* Copyright (C) 1995, Silicon Graphics, Inc. *
|
||||
* *
|
||||
* These coded instructions, statements, and computer programs contain *
|
||||
* unpublished proprietary information of Silicon Graphics, Inc., and *
|
||||
* are protected by Federal copyright law. They may not be disclosed *
|
||||
* to third parties or copied or duplicated in any form, in whole or *
|
||||
* in part, without the prior written consent of Silicon Graphics, Inc. *
|
||||
* *
|
||||
**************************************************************************/
|
||||
|
||||
/* Internal functions used by the operating system */
|
||||
/* Do not include this header in application code */
|
||||
/**************************************************************************
|
||||
*
|
||||
* $Revision: 1.18 $
|
||||
* $Date: 1997/02/11 08:26:14 $
|
||||
* $Source: /disk6/Master/cvsmdev2/PR/include/os_internal.h,v $
|
||||
*
|
||||
**************************************************************************/
|
||||
|
||||
/* Variables */
|
||||
|
||||
extern u64 osClockRate;
|
||||
|
||||
/* Functions */
|
||||
|
||||
/*u32 __osProbeTLB(void *);
|
||||
u32 __osDisableInt(void);
|
||||
void __osRestoreInt(u32);*/
|
||||
OSThread *__osGetCurrFaultedThread(void);
|
||||
#ifndef _OS_INTERNAL_H_
|
||||
#define _OS_INTERNAL_H_
|
||||
|
||||
#ifdef _LANGUAGE_C_PLUS_PLUS
|
||||
extern "C" {
|
||||
#endif
|
||||
|
||||
#include <PR/os.h>
|
||||
|
||||
#if defined(_LANGUAGE_C) || defined(_LANGUAGE_C_PLUS_PLUS)
|
||||
|
||||
/* Routines to get/fetch coprocessor 0 registers */
|
||||
|
||||
extern u32 __osGetCause(void);
|
||||
extern void __osSetCause(u32);
|
||||
extern u32 __osGetCompare(void);
|
||||
extern void __osSetCompare(u32);
|
||||
extern u32 __osGetConfig(void);
|
||||
extern void __osSetConfig(u32);
|
||||
extern void __osSetCount(u32);
|
||||
extern u32 __osGetSR(void);
|
||||
extern void __osSetSR(u32);
|
||||
extern u32 __osDisableInt(void);
|
||||
extern void __osRestoreInt(u32);
|
||||
|
||||
/* Routines to get/set floating-point control and status register */
|
||||
extern u32 __osSetFpcCsr(u32);
|
||||
extern u32 __osGetFpcCsr(void);
|
||||
|
||||
/* Routine for HW interrupt "handler" */
|
||||
extern void __osSetHWIntrRoutine(OSHWIntr, s32 (*handler)(void));
|
||||
|
||||
/* Routine for global interrupt mask */
|
||||
extern void __osSetGlobalIntMask(OSHWIntr);
|
||||
extern void __osResetGlobalIntMask(OSHWIntr);
|
||||
|
||||
/* Routine for global interrupt mask */
|
||||
extern s32 __osLeoInterrupt(void);
|
||||
|
||||
/* Routines for fetch TLB info */
|
||||
|
||||
extern u32 __osGetTLBASID(void);
|
||||
extern u32 __osGetTLBPageMask(s32);
|
||||
extern u32 __osGetTLBHi(s32);
|
||||
extern u32 __osGetTLBLo0(s32);
|
||||
extern u32 __osGetTLBLo1(s32);
|
||||
|
||||
/* Serial interface (Si) */
|
||||
|
||||
extern u32 __osSiGetStatus(void);
|
||||
extern s32 __osSiRawWriteIo(u32, u32);
|
||||
extern s32 __osSiRawReadIo(u32, u32 *);
|
||||
extern s32 __osSiRawStartDma(s32, void *);
|
||||
|
||||
/* Signal processor interface (Sp) */
|
||||
|
||||
extern u32 __osSpGetStatus(void);
|
||||
extern void __osSpSetStatus(u32);
|
||||
extern s32 __osSpSetPc(u32);
|
||||
extern s32 __osSpRawWriteIo(u32, u32);
|
||||
extern s32 __osSpRawReadIo(u32, u32 *);
|
||||
extern s32 __osSpRawStartDma(s32, u32, void *, u32);
|
||||
|
||||
/* Error handling */
|
||||
|
||||
extern void __osError(s16, s16, ...);
|
||||
extern OSThread * __osGetCurrFaultedThread(void);
|
||||
extern OSThread * __osGetNextFaultedThread(OSThread *);
|
||||
|
||||
/* Development board functions */
|
||||
|
||||
extern void __osGIOInit(s32);
|
||||
extern void __osGIOInterrupt(s32);
|
||||
extern void __osGIORawInterrupt(s32);
|
||||
|
||||
/* For debugger use */
|
||||
|
||||
extern OSThread * __osGetActiveQueue(void);
|
||||
|
||||
/* Debug port */
|
||||
extern void __osSyncPutChars(int, int, const char *);
|
||||
extern int __osSyncGetChars(char *);
|
||||
extern void __osAsyncPutChars(int, int, const char *);
|
||||
extern int __osAsyncGetChars(char *);
|
||||
extern int __osAtomicInc(unsigned int *p);
|
||||
extern int __osAtomicDec(unsigned int *p);
|
||||
|
||||
/* routine for rdb port */
|
||||
extern u32 __osRdbSend(u8 *buf, u32 size, u32 type);
|
||||
|
||||
|
||||
#endif /* _LANGUAGE_C */
|
||||
|
||||
#ifdef _LANGUAGE_C_PLUS_PLUS
|
||||
}
|
||||
#endif
|
||||
|
||||
#endif /* !_OS_INTERNAL_H */
|
||||
@@ -1,10 +0,0 @@
|
||||
#ifndef _OS_LIBC_H_
|
||||
#define _OS_LIBC_H_
|
||||
|
||||
#include "ultratypes.h"
|
||||
|
||||
// Old deprecated functions from strings.h, replaced by memcpy/memset.
|
||||
extern void bcopy(const void *, void *, size_t);
|
||||
extern void bzero(void *, size_t);
|
||||
|
||||
#endif /* !_OS_LIBC_H_ */
|
||||
@@ -1,164 +0,0 @@
|
||||
|
||||
/*====================================================================
|
||||
* os_message.h
|
||||
*
|
||||
* Copyright 1995, Silicon Graphics, Inc.
|
||||
* All Rights Reserved.
|
||||
*
|
||||
* This is UNPUBLISHED PROPRIETARY SOURCE CODE of Silicon Graphics,
|
||||
* Inc.; the contents of this file may not be disclosed to third
|
||||
* parties, copied or duplicated in any form, in whole or in part,
|
||||
* without the prior written permission of Silicon Graphics, Inc.
|
||||
*
|
||||
* RESTRICTED RIGHTS LEGEND:
|
||||
* Use, duplication or disclosure by the Government is subject to
|
||||
* restrictions as set forth in subdivision (c)(1)(ii) of the Rights
|
||||
* in Technical Data and Computer Software clause at DFARS
|
||||
* 252.227-7013, and/or in similar or successor clauses in the FAR,
|
||||
* DOD or NASA FAR Supplement. Unpublished - rights reserved under the
|
||||
* Copyright Laws of the United States.
|
||||
*====================================================================*/
|
||||
|
||||
/*---------------------------------------------------------------------*
|
||||
Copyright (C) 1998 Nintendo. (Originated by SGI)
|
||||
|
||||
$RCSfile: os_message.h,v $
|
||||
$Revision: 1.1 $
|
||||
$Date: 1998/10/09 08:01:15 $
|
||||
*---------------------------------------------------------------------*/
|
||||
|
||||
#ifndef _OS_MESSAGE_H_
|
||||
#define _OS_MESSAGE_H_
|
||||
|
||||
#ifdef _LANGUAGE_C_PLUS_PLUS
|
||||
extern "C" {
|
||||
#endif
|
||||
|
||||
#include <PR/ultratypes.h>
|
||||
#include <PR/os_thread.h>
|
||||
|
||||
#if defined(_LANGUAGE_C) || defined(_LANGUAGE_C_PLUS_PLUS)
|
||||
|
||||
/**************************************************************************
|
||||
*
|
||||
* Type definitions
|
||||
*
|
||||
*/
|
||||
|
||||
typedef u32 OSEvent;
|
||||
|
||||
/*
|
||||
* Structure for message
|
||||
*/
|
||||
typedef void * OSMesg;
|
||||
|
||||
/*
|
||||
* Structure for message queue
|
||||
*/
|
||||
typedef struct OSMesgQueue_s {
|
||||
OSThread *mtqueue; /* Queue to store threads blocked
|
||||
on empty mailboxes (receive) */
|
||||
OSThread *fullqueue; /* Queue to store threads blocked
|
||||
on full mailboxes (send) */
|
||||
s32 validCount; /* Contains number of valid message */
|
||||
s32 first; /* Points to first valid message */
|
||||
s32 msgCount; /* Contains total # of messages */
|
||||
OSMesg *msg; /* Points to message buffer array */
|
||||
} OSMesgQueue;
|
||||
|
||||
|
||||
#endif /* defined(_LANGUAGE_C) || defined(_LANGUAGE_C_PLUS_PLUS) */
|
||||
|
||||
/**************************************************************************
|
||||
*
|
||||
* Global definitions
|
||||
*
|
||||
*/
|
||||
|
||||
/* Events */
|
||||
#ifdef _FINALROM
|
||||
#define OS_NUM_EVENTS 15
|
||||
#else
|
||||
#define OS_NUM_EVENTS 23
|
||||
#endif
|
||||
|
||||
#define OS_EVENT_SW1 0 /* CPU SW1 interrupt */
|
||||
#define OS_EVENT_SW2 1 /* CPU SW2 interrupt */
|
||||
#define OS_EVENT_CART 2 /* Cartridge interrupt: used by rmon */
|
||||
#define OS_EVENT_COUNTER 3 /* Counter int: used by VI/Timer Mgr */
|
||||
#define OS_EVENT_SP 4 /* SP task done interrupt */
|
||||
#define OS_EVENT_SI 5 /* SI (controller) interrupt */
|
||||
#define OS_EVENT_AI 6 /* AI interrupt */
|
||||
#define OS_EVENT_VI 7 /* VI interrupt: used by VI/Timer Mgr */
|
||||
#define OS_EVENT_PI 8 /* PI interrupt: used by PI Manager */
|
||||
#define OS_EVENT_DP 9 /* DP full sync interrupt */
|
||||
#define OS_EVENT_CPU_BREAK 10 /* CPU breakpoint: used by rmon */
|
||||
#define OS_EVENT_SP_BREAK 11 /* SP breakpoint: used by rmon */
|
||||
#define OS_EVENT_FAULT 12 /* CPU fault event: used by rmon */
|
||||
#define OS_EVENT_THREADSTATUS 13 /* CPU thread status: used by rmon */
|
||||
#define OS_EVENT_PRENMI 14 /* Pre NMI interrupt */
|
||||
#ifndef _FINALROM
|
||||
#define OS_EVENT_RDB_READ_DONE 15 /* RDB read ok event: used by rmon */
|
||||
#define OS_EVENT_RDB_LOG_DONE 16 /* read of log data complete */
|
||||
#define OS_EVENT_RDB_DATA_DONE 17 /* read of hostio data complete */
|
||||
#define OS_EVENT_RDB_REQ_RAMROM 18 /* host needs ramrom access */
|
||||
#define OS_EVENT_RDB_FREE_RAMROM 19 /* host is done with ramrom access */
|
||||
#define OS_EVENT_RDB_DBG_DONE 20
|
||||
#define OS_EVENT_RDB_FLUSH_PROF 21
|
||||
#define OS_EVENT_RDB_ACK_PROF 22
|
||||
#endif
|
||||
|
||||
/* Flags to turn blocking on/off when sending/receiving message */
|
||||
|
||||
#define OS_MESG_NOBLOCK 0
|
||||
#define OS_MESG_BLOCK 1
|
||||
|
||||
|
||||
#if defined(_LANGUAGE_C) || defined(_LANGUAGE_C_PLUS_PLUS)
|
||||
|
||||
/**************************************************************************
|
||||
*
|
||||
* Macro definitions
|
||||
*
|
||||
*/
|
||||
|
||||
/* Get count of valid messages in queue */
|
||||
#define MQ_GET_COUNT(mq) ((mq)->validCount)
|
||||
|
||||
/* Figure out if message queue is empty or full */
|
||||
#define MQ_IS_EMPTY(mq) (MQ_GET_COUNT(mq) == 0)
|
||||
#define MQ_IS_FULL(mq) (MQ_GET_COUNT(mq) >= (mq)->msgCount)
|
||||
|
||||
|
||||
/**************************************************************************
|
||||
*
|
||||
* Extern variables
|
||||
*
|
||||
*/
|
||||
|
||||
|
||||
/**************************************************************************
|
||||
*
|
||||
* Function prototypes
|
||||
*
|
||||
*/
|
||||
|
||||
/* Message operations */
|
||||
|
||||
extern void osCreateMesgQueue(OSMesgQueue *, OSMesg *, s32);
|
||||
extern s32 osSendMesg(OSMesgQueue *, OSMesg, s32);
|
||||
extern s32 osJamMesg(OSMesgQueue *, OSMesg, s32);
|
||||
extern s32 osRecvMesg(OSMesgQueue *, OSMesg *, s32);
|
||||
|
||||
/* Event operations */
|
||||
|
||||
extern void osSetEventMesg(OSEvent, OSMesgQueue *, OSMesg);
|
||||
|
||||
|
||||
#endif /* defined(_LANGUAGE_C) || defined(_LANGUAGE_C_PLUS_PLUS) */
|
||||
|
||||
#ifdef _LANGUAGE_C_PLUS_PLUS
|
||||
}
|
||||
#endif
|
||||
|
||||
#endif /* !_OS_MESSAGE_H_ */
|
||||
@@ -1,11 +0,0 @@
|
||||
#ifndef _ULTRA64_OS_MISC_H_
|
||||
#define _ULTRA64_OS_MISC_H_
|
||||
#include <PR/ultratypes.h>
|
||||
/* Miscellaneous OS functions */
|
||||
|
||||
void osInitialize(void);
|
||||
u32 osGetCount(void);
|
||||
|
||||
uintptr_t osVirtualToPhysical(void *);
|
||||
|
||||
#endif
|
||||
@@ -1,86 +0,0 @@
|
||||
#ifndef _ULTRA64_PI_H_
|
||||
#define _ULTRA64_PI_H_
|
||||
#include <ultra64.h>
|
||||
|
||||
/* Ultra64 Parallel Interface */
|
||||
|
||||
/* Types */
|
||||
|
||||
typedef struct {
|
||||
#if !defined(VERSION_EU)
|
||||
u32 errStatus;
|
||||
#endif
|
||||
void *dramAddr;
|
||||
void *C2Addr;
|
||||
u32 sectorSize;
|
||||
u32 C1ErrNum;
|
||||
u32 C1ErrSector[4];
|
||||
} __OSBlockInfo;
|
||||
|
||||
typedef struct {
|
||||
u32 cmdType; // 0
|
||||
u16 transferMode; // 4
|
||||
u16 blockNum; // 6
|
||||
s32 sectorNum; // 8
|
||||
uintptr_t devAddr; // c
|
||||
#if defined(VERSION_EU)
|
||||
u32 errStatus; //error status added moved to blockinfo
|
||||
#endif
|
||||
u32 bmCtlShadow; // 10
|
||||
u32 seqCtlShadow; // 14
|
||||
__OSBlockInfo block[2]; // 18
|
||||
} __OSTranxInfo;
|
||||
|
||||
typedef struct OSPiHandle_s {
|
||||
struct OSPiHandle_s *next;
|
||||
u8 type;
|
||||
u8 latency;
|
||||
u8 pageSize;
|
||||
u8 relDuration;
|
||||
u8 pulse;
|
||||
u8 domain;
|
||||
u32 baseAddress;
|
||||
u32 speed;
|
||||
__OSTranxInfo transferInfo;
|
||||
} OSPiHandle;
|
||||
|
||||
typedef struct {
|
||||
u8 type;
|
||||
uintptr_t address;
|
||||
} OSPiInfo;
|
||||
|
||||
typedef struct {
|
||||
u16 type;
|
||||
u8 pri;
|
||||
u8 status;
|
||||
OSMesgQueue *retQueue;
|
||||
} OSIoMesgHdr;
|
||||
|
||||
typedef struct {
|
||||
/*0x00*/ OSIoMesgHdr hdr;
|
||||
/*0x08*/ void *dramAddr;
|
||||
/*0x0C*/ uintptr_t devAddr;
|
||||
/*0x10*/ size_t size;
|
||||
OSPiHandle *piHandle; // from the official definition
|
||||
} OSIoMesg;
|
||||
|
||||
/* Definitions */
|
||||
|
||||
#define OS_READ 0 // device -> RDRAM
|
||||
#define OS_WRITE 1 // device <- RDRAM
|
||||
|
||||
#define OS_MESG_PRI_NORMAL 0
|
||||
#define OS_MESG_PRI_HIGH 1
|
||||
|
||||
/* Functions */
|
||||
|
||||
s32 osPiStartDma(OSIoMesg *mb, s32 priority, s32 direction, uintptr_t devAddr, void *vAddr,
|
||||
size_t nbytes, OSMesgQueue *mq);
|
||||
void osCreatePiManager(OSPri pri, OSMesgQueue *cmdQ, OSMesg *cmdBuf, s32 cmdMsgCnt);
|
||||
OSMesgQueue *osPiGetCmdQueue(void);
|
||||
s32 osPiWriteIo(uintptr_t devAddr, u32 data);
|
||||
s32 osPiReadIo(uintptr_t devAddr, u32 *data);
|
||||
|
||||
s32 osPiRawStartDma(s32 dir, u32 cart_addr, void *dram_addr, size_t size);
|
||||
s32 osEPiRawStartDma(OSPiHandle *piHandle, s32 dir, u32 cart_addr, void *dram_addr, size_t size);
|
||||
#endif
|
||||
@@ -1,92 +0,0 @@
|
||||
|
||||
/*====================================================================
|
||||
* os_rdp.h
|
||||
*
|
||||
* Copyright 1995, Silicon Graphics, Inc.
|
||||
* All Rights Reserved.
|
||||
*
|
||||
* This is UNPUBLISHED PROPRIETARY SOURCE CODE of Silicon Graphics,
|
||||
* Inc.; the contents of this file may not be disclosed to third
|
||||
* parties, copied or duplicated in any form, in whole or in part,
|
||||
* without the prior written permission of Silicon Graphics, Inc.
|
||||
*
|
||||
* RESTRICTED RIGHTS LEGEND:
|
||||
* Use, duplication or disclosure by the Government is subject to
|
||||
* restrictions as set forth in subdivision (c)(1)(ii) of the Rights
|
||||
* in Technical Data and Computer Software clause at DFARS
|
||||
* 252.227-7013, and/or in similar or successor clauses in the FAR,
|
||||
* DOD or NASA FAR Supplement. Unpublished - rights reserved under the
|
||||
* Copyright Laws of the United States.
|
||||
*====================================================================*/
|
||||
|
||||
/*---------------------------------------------------------------------*
|
||||
Copyright (C) 1998 Nintendo. (Originated by SGI)
|
||||
|
||||
$RCSfile: os_rdp.h,v $
|
||||
$Revision: 1.1 $
|
||||
$Date: 1998/10/09 08:01:16 $
|
||||
*---------------------------------------------------------------------*/
|
||||
|
||||
#ifndef _OS_RDP_H_
|
||||
#define _OS_RDP_H_
|
||||
|
||||
#ifdef _LANGUAGE_C_PLUS_PLUS
|
||||
extern "C" {
|
||||
#endif
|
||||
|
||||
#include <PR/ultratypes.h>
|
||||
|
||||
#if defined(_LANGUAGE_C) || defined(_LANGUAGE_C_PLUS_PLUS)
|
||||
|
||||
/**************************************************************************
|
||||
*
|
||||
* Type definitions
|
||||
*
|
||||
*/
|
||||
|
||||
|
||||
#endif /* defined(_LANGUAGE_C) || defined(_LANGUAGE_C_PLUS_PLUS) */
|
||||
|
||||
/**************************************************************************
|
||||
*
|
||||
* Global definitions
|
||||
*
|
||||
*/
|
||||
|
||||
|
||||
#if defined(_LANGUAGE_C) || defined(_LANGUAGE_C_PLUS_PLUS)
|
||||
|
||||
/**************************************************************************
|
||||
*
|
||||
* Macro definitions
|
||||
*
|
||||
*/
|
||||
|
||||
|
||||
/**************************************************************************
|
||||
*
|
||||
* Extern variables
|
||||
*
|
||||
*/
|
||||
|
||||
|
||||
/**************************************************************************
|
||||
*
|
||||
* Function prototypes
|
||||
*
|
||||
*/
|
||||
|
||||
/* Display processor interface (Dp) */
|
||||
extern u32 osDpGetStatus(void);
|
||||
extern void osDpSetStatus(u32);
|
||||
extern void osDpGetCounters(u32 *);
|
||||
extern s32 osDpSetNextBuffer(void *, u64);
|
||||
|
||||
|
||||
#endif /* defined(_LANGUAGE_C) || defined(_LANGUAGE_C_PLUS_PLUS) */
|
||||
|
||||
#ifdef _LANGUAGE_C_PLUS_PLUS
|
||||
}
|
||||
#endif
|
||||
|
||||
#endif /* !_OS_RDP_H_ */
|
||||
@@ -1,75 +0,0 @@
|
||||
#ifndef _ULTRA64_THREAD_H_
|
||||
#define _ULTRA64_THREAD_H_
|
||||
#include "ultratypes.h"
|
||||
/* Recommended priorities for system threads */
|
||||
#define OS_PRIORITY_MAX 255
|
||||
#define OS_PRIORITY_VIMGR 254
|
||||
#define OS_PRIORITY_RMON 250
|
||||
#define OS_PRIORITY_RMONSPIN 200
|
||||
#define OS_PRIORITY_PIMGR 150
|
||||
#define OS_PRIORITY_SIMGR 140
|
||||
#define OS_PRIORITY_APPMAX 127
|
||||
#define OS_PRIORITY_IDLE 0
|
||||
|
||||
#define OS_STATE_STOPPED 1
|
||||
#define OS_STATE_RUNNABLE 2
|
||||
#define OS_STATE_RUNNING 4
|
||||
#define OS_STATE_WAITING 8
|
||||
|
||||
/* Types */
|
||||
|
||||
typedef s32 OSPri;
|
||||
typedef s32 OSId;
|
||||
|
||||
typedef union
|
||||
{
|
||||
struct {f32 f_odd; f32 f_even;} f;
|
||||
} __OSfp;
|
||||
|
||||
typedef struct
|
||||
{
|
||||
/* registers */
|
||||
/*0x20*/ u64 at, v0, v1, a0, a1, a2, a3;
|
||||
/*0x58*/ u64 t0, t1, t2, t3, t4, t5, t6, t7;
|
||||
/*0x98*/ u64 s0, s1, s2, s3, s4, s5, s6, s7;
|
||||
/*0xD8*/ u64 t8, t9, gp, sp, s8, ra;
|
||||
/*0x108*/ u64 lo, hi;
|
||||
/*0x118*/ u32 sr, pc, cause, badvaddr, rcp;
|
||||
/*0x12C*/ u32 fpcsr;
|
||||
__OSfp fp0, fp2, fp4, fp6, fp8, fp10, fp12, fp14;
|
||||
__OSfp fp16, fp18, fp20, fp22, fp24, fp26, fp28, fp30;
|
||||
} __OSThreadContext;
|
||||
|
||||
typedef struct
|
||||
{
|
||||
u32 flag;
|
||||
u32 count;
|
||||
u64 time;
|
||||
} __OSThreadprofile_s;
|
||||
|
||||
typedef struct OSThread_s
|
||||
{
|
||||
/*0x00*/ struct OSThread_s *next;
|
||||
/*0x04*/ OSPri priority;
|
||||
/*0x08*/ struct OSThread_s **queue;
|
||||
/*0x0C*/ struct OSThread_s *tlnext;
|
||||
/*0x10*/ u16 state;
|
||||
/*0x12*/ u16 flags;
|
||||
/*0x14*/ OSId id;
|
||||
/*0x18*/ int fp;
|
||||
/*0x1C*/ __OSThreadprofile_s *thprof;
|
||||
/*0x20*/ __OSThreadContext context;
|
||||
} OSThread;
|
||||
|
||||
|
||||
/* Functions */
|
||||
|
||||
void osCreateThread(OSThread *thread, OSId id, void (*entry)(void *),
|
||||
void *arg, void *sp, OSPri pri);
|
||||
OSId osGetThreadId(OSThread *thread);
|
||||
OSPri osGetThreadPri(OSThread *thread);
|
||||
void osSetThreadPri(OSThread *thread, OSPri pri);
|
||||
void osStartThread(OSThread *thread);
|
||||
void osStopThread(OSThread *thread);
|
||||
|
||||
#endif
|
||||
@@ -1,27 +0,0 @@
|
||||
#ifndef _ULTRA64_TIME_H_
|
||||
#define _ULTRA64_TIME_H_
|
||||
|
||||
#include <PR/ultratypes.h>
|
||||
#include <PR/os_message.h>
|
||||
|
||||
/* Types */
|
||||
|
||||
typedef struct OSTimer_str
|
||||
{
|
||||
struct OSTimer_str *next;
|
||||
struct OSTimer_str *prev;
|
||||
u64 interval;
|
||||
u64 remaining;
|
||||
OSMesgQueue *mq;
|
||||
OSMesg *msg;
|
||||
} OSTimer;
|
||||
|
||||
typedef u64 OSTime;
|
||||
|
||||
/* Functions */
|
||||
|
||||
OSTime osGetTime(void);
|
||||
void osSetTime(OSTime time);
|
||||
u32 osSetTimer(OSTimer *, OSTime, OSTime, OSMesgQueue *, OSMesg);
|
||||
|
||||
#endif
|
||||
@@ -1,107 +0,0 @@
|
||||
|
||||
/*====================================================================
|
||||
* os_tlb.h
|
||||
*
|
||||
* Copyright 1995, Silicon Graphics, Inc.
|
||||
* All Rights Reserved.
|
||||
*
|
||||
* This is UNPUBLISHED PROPRIETARY SOURCE CODE of Silicon Graphics,
|
||||
* Inc.; the contents of this file may not be disclosed to third
|
||||
* parties, copied or duplicated in any form, in whole or in part,
|
||||
* without the prior written permission of Silicon Graphics, Inc.
|
||||
*
|
||||
* RESTRICTED RIGHTS LEGEND:
|
||||
* Use, duplication or disclosure by the Government is subject to
|
||||
* restrictions as set forth in subdivision (c)(1)(ii) of the Rights
|
||||
* in Technical Data and Computer Software clause at DFARS
|
||||
* 252.227-7013, and/or in similar or successor clauses in the FAR,
|
||||
* DOD or NASA FAR Supplement. Unpublished - rights reserved under the
|
||||
* Copyright Laws of the United States.
|
||||
*====================================================================*/
|
||||
|
||||
/*---------------------------------------------------------------------*
|
||||
Copyright (C) 1998 Nintendo. (Originated by SGI)
|
||||
|
||||
$RCSfile: os_tlb.h,v $
|
||||
$Revision: 1.1 $
|
||||
$Date: 1998/10/09 08:01:20 $
|
||||
*---------------------------------------------------------------------*/
|
||||
|
||||
#ifndef _OS_TLB_H_
|
||||
#define _OS_TLB_H_
|
||||
|
||||
#ifdef _LANGUAGE_C_PLUS_PLUS
|
||||
extern "C" {
|
||||
#endif
|
||||
|
||||
#include <PR/ultratypes.h>
|
||||
|
||||
#if defined(_LANGUAGE_C) || defined(_LANGUAGE_C_PLUS_PLUS)
|
||||
|
||||
/**************************************************************************
|
||||
*
|
||||
* Type definitions
|
||||
*
|
||||
*/
|
||||
|
||||
typedef u32 OSPageMask;
|
||||
|
||||
|
||||
#endif /* defined(_LANGUAGE_C) || defined(_LANGUAGE_C_PLUS_PLUS) */
|
||||
|
||||
/**************************************************************************
|
||||
*
|
||||
* Global definitions
|
||||
*
|
||||
*/
|
||||
|
||||
/*
|
||||
* Page size argument for TLB routines
|
||||
*/
|
||||
#define OS_PM_4K 0x0000000
|
||||
#define OS_PM_16K 0x0006000
|
||||
#define OS_PM_64K 0x001e000
|
||||
#define OS_PM_256K 0x007e000
|
||||
#define OS_PM_1M 0x01fe000
|
||||
#define OS_PM_4M 0x07fe000
|
||||
#define OS_PM_16M 0x1ffe000
|
||||
|
||||
|
||||
#if defined(_LANGUAGE_C) || defined(_LANGUAGE_C_PLUS_PLUS)
|
||||
|
||||
/**************************************************************************
|
||||
*
|
||||
* Macro definitions
|
||||
*
|
||||
*/
|
||||
|
||||
|
||||
/**************************************************************************
|
||||
*
|
||||
* Extern variables
|
||||
*
|
||||
*/
|
||||
|
||||
|
||||
/**************************************************************************
|
||||
*
|
||||
* Function prototypes
|
||||
*
|
||||
*/
|
||||
|
||||
/* TLB management routines */
|
||||
|
||||
extern void osMapTLB(s32, OSPageMask, void *, u32, u32, s32);
|
||||
extern void osMapTLBRdb(void);
|
||||
extern void osUnmapTLB(s32);
|
||||
extern void osUnmapTLBAll(void);
|
||||
extern void osSetTLBASID(s32);
|
||||
|
||||
|
||||
#endif /* defined(_LANGUAGE_C) || defined(_LANGUAGE_C_PLUS_PLUS) */
|
||||
|
||||
#ifdef _LANGUAGE_C_PLUS_PLUS
|
||||
}
|
||||
#endif
|
||||
|
||||
#endif /* !_OS_TLB_H_ */
|
||||
@@ -1,118 +0,0 @@
|
||||
#ifndef _ULTRA64_VI_H_
|
||||
#define _ULTRA64_VI_H_
|
||||
|
||||
#include <PR/ultratypes.h>
|
||||
#include <PR/os_message.h>
|
||||
|
||||
/* Ultra64 Video Interface */
|
||||
|
||||
|
||||
/* Special Features */
|
||||
#define OS_VI_GAMMA_ON 0x0001
|
||||
#define OS_VI_GAMMA_OFF 0x0002
|
||||
#define OS_VI_GAMMA_DITHER_ON 0x0004
|
||||
#define OS_VI_GAMMA_DITHER_OFF 0x0008
|
||||
#define OS_VI_DIVOT_ON 0x0010
|
||||
#define OS_VI_DIVOT_OFF 0x0020
|
||||
#define OS_VI_DITHER_FILTER_ON 0x0040
|
||||
#define OS_VI_DITHER_FILTER_OFF 0x0080
|
||||
|
||||
#define OS_VI_GAMMA 0x08
|
||||
#define OS_VI_GAMMA_DITHER 0x04
|
||||
#define OS_VI_DIVOT 0x10
|
||||
#define OS_VI_DITHER_FILTER 0x10000
|
||||
#define OS_VI_UNK200 0x200
|
||||
#define OS_VI_UNK100 0x100
|
||||
|
||||
|
||||
/* Types */
|
||||
|
||||
typedef struct
|
||||
{
|
||||
u32 ctrl;
|
||||
u32 width;
|
||||
u32 burst;
|
||||
u32 vSync;
|
||||
u32 hSync;
|
||||
u32 leap;
|
||||
u32 hStart;
|
||||
u32 xScale;
|
||||
u32 vCurrent;
|
||||
} OSViCommonRegs;
|
||||
|
||||
typedef struct
|
||||
{
|
||||
u32 origin;
|
||||
u32 yScale;
|
||||
u32 vStart;
|
||||
u32 vBurst;
|
||||
u32 vIntr;
|
||||
} OSViFieldRegs;
|
||||
|
||||
typedef struct
|
||||
{
|
||||
u8 type;
|
||||
OSViCommonRegs comRegs;
|
||||
OSViFieldRegs fldRegs[2];
|
||||
} OSViMode;
|
||||
|
||||
typedef struct
|
||||
{
|
||||
/* 0x00 */ u16 unk00; //some kind of flags. swap buffer sets to 0x10
|
||||
/* 0x02 */ u16 retraceCount;
|
||||
/* 0x04 */ void* buffer;
|
||||
/* 0x08 */ OSViMode *modep;
|
||||
/* 0x0c */ u32 features;
|
||||
/* 0x10 */ OSMesgQueue *mq;
|
||||
/* 0x14 */ OSMesg *msg;
|
||||
/* 0x18 */ u32 unk18;
|
||||
/* 0x1c */ u32 unk1c;
|
||||
/* 0x20 */ u32 unk20;
|
||||
/* 0x24 */ f32 unk24;
|
||||
/* 0x28 */ u16 unk28;
|
||||
/* 0x2c */ u32 unk2c;
|
||||
} OSViContext;
|
||||
|
||||
void osCreateViManager(OSPri pri);
|
||||
void osViSetMode(OSViMode *mode);
|
||||
void osViSetEvent(OSMesgQueue *mq, OSMesg msg, u32 retraceCount);
|
||||
void osViBlack(u8 active);
|
||||
void osViSetSpecialFeatures(u32 func);
|
||||
void osViSwapBuffer(void *vaddr);
|
||||
|
||||
|
||||
#define OS_VI_NTSC_LPN1 0 /* NTSC */
|
||||
#define OS_VI_NTSC_LPF1 1
|
||||
#define OS_VI_NTSC_LAN1 2
|
||||
#define OS_VI_NTSC_LAF1 3
|
||||
#define OS_VI_NTSC_LPN2 4
|
||||
#define OS_VI_NTSC_LPF2 5
|
||||
#define OS_VI_NTSC_LAN2 6
|
||||
#define OS_VI_NTSC_LAF2 7
|
||||
#define OS_VI_NTSC_HPN1 8
|
||||
#define OS_VI_NTSC_HPF1 9
|
||||
#define OS_VI_NTSC_HAN1 10
|
||||
#define OS_VI_NTSC_HAF1 11
|
||||
#define OS_VI_NTSC_HPN2 12
|
||||
#define OS_VI_NTSC_HPF2 13
|
||||
|
||||
#define OS_VI_PAL_LPN1 14 /* PAL */
|
||||
#define OS_VI_PAL_LPF1 15
|
||||
#define OS_VI_PAL_LAN1 16
|
||||
#define OS_VI_PAL_LAF1 17
|
||||
#define OS_VI_PAL_LPN2 18
|
||||
#define OS_VI_PAL_LPF2 19
|
||||
#define OS_VI_PAL_LAN2 20
|
||||
#define OS_VI_PAL_LAF2 21
|
||||
#define OS_VI_PAL_HPN1 22
|
||||
#define OS_VI_PAL_HPF1 23
|
||||
#define OS_VI_PAL_HAN1 24
|
||||
#define OS_VI_PAL_HAF1 25
|
||||
#define OS_VI_PAL_HPN2 26
|
||||
#define OS_VI_PAL_HPF2 27
|
||||
|
||||
#define OS_VI_MPAL_LAN1 30
|
||||
extern OSViMode osViModeTable[]; /* Global VI mode table */
|
||||
|
||||
|
||||
#endif
|
||||
@@ -0,0 +1,118 @@
|
||||
#ifndef __GL_IMAGE_H__
|
||||
#define __GL_IMAGE_H__
|
||||
#ifdef __cplusplus
|
||||
extern "C" {
|
||||
#endif
|
||||
|
||||
|
||||
/*
|
||||
* Defines for image files . . . .
|
||||
*
|
||||
* Paul Haeberli - 1984
|
||||
* Look in /usr/people/4Dgifts/iristools/imgtools for example code!
|
||||
*
|
||||
*/
|
||||
|
||||
#include <stdio.h>
|
||||
|
||||
#define IMAGIC 0732
|
||||
|
||||
/* colormap of images */
|
||||
#define CM_NORMAL 0 /* file contains rows of values which
|
||||
* are either RGB values (zsize == 3)
|
||||
* or greyramp values (zsize == 1) */
|
||||
#define CM_DITHERED 1
|
||||
#define CM_SCREEN 2 /* file contains data which is a screen
|
||||
* image; getrow returns buffer which
|
||||
* can be displayed directly with
|
||||
* writepixels */
|
||||
#define CM_COLORMAP 3 /* a colormap file */
|
||||
|
||||
#define TYPEMASK 0xff00
|
||||
#define BPPMASK 0x00ff
|
||||
#define ITYPE_VERBATIM 0x0000
|
||||
#define ITYPE_RLE 0x0100
|
||||
#define ISRLE(type) (((type) & 0xff00) == ITYPE_RLE)
|
||||
#define ISVERBATIM(type) (((type) & 0xff00) == ITYPE_VERBATIM)
|
||||
#define BPP(type) ((type) & BPPMASK)
|
||||
#define RLE(bpp) (ITYPE_RLE | (bpp))
|
||||
#define VERBATIM(bpp) (ITYPE_VERBATIM | (bpp))
|
||||
#define IBUFSIZE(pixels) ((pixels+(pixels>>6))<<2)
|
||||
#define RLE_NOP 0x00
|
||||
|
||||
#define ierror(p) (((p)->flags&_IOERR)!=0)
|
||||
#define ifileno(p) ((p)->file)
|
||||
#define getpix(p) (--(p)->cnt>=0 ? *(p)->ptr++ : ifilbuf(p))
|
||||
#define putpix(p,x) (--(p)->cnt>=0 \
|
||||
? ((int)(*(p)->ptr++=(unsigned)(x))) \
|
||||
: iflsbuf(p,(unsigned)(x)))
|
||||
|
||||
typedef struct {
|
||||
unsigned short imagic; /* stuff saved on disk . . */
|
||||
unsigned short type;
|
||||
unsigned short dim;
|
||||
unsigned short xsize;
|
||||
unsigned short ysize;
|
||||
unsigned short zsize;
|
||||
unsigned long min;
|
||||
unsigned long max;
|
||||
unsigned long wastebytes;
|
||||
char name[80];
|
||||
unsigned long colormap;
|
||||
|
||||
long file; /* stuff used in core only */
|
||||
unsigned short flags;
|
||||
short dorev;
|
||||
short x;
|
||||
short y;
|
||||
short z;
|
||||
short cnt;
|
||||
unsigned short *ptr;
|
||||
unsigned short *base;
|
||||
unsigned short *tmpbuf;
|
||||
unsigned long offset;
|
||||
unsigned long rleend; /* for rle images */
|
||||
unsigned long *rowstart; /* for rle images */
|
||||
long *rowsize; /* for rle images */
|
||||
} IMAGE;
|
||||
|
||||
IMAGE *icreate();
|
||||
/*
|
||||
* IMAGE *iopen(char *file, char *mode, unsigned int type, unsigned int dim,
|
||||
* unsigned int xsize, unsigned int ysize, unsigned int zsize);
|
||||
* IMAGE *fiopen(int f, char *mode, unsigned int type, unsigned int dim,
|
||||
* unsigned int xsize, unsigned int ysize, unsigned int zsize);
|
||||
*
|
||||
* ...while iopen and fiopen can take an extended set of parameters, the
|
||||
* last five are optional, so a more correct prototype would be:
|
||||
*
|
||||
*/
|
||||
IMAGE *iopen(char *file, char *mode, ...);
|
||||
IMAGE *fiopen(int f, char *mode, ...);
|
||||
|
||||
/*
|
||||
*
|
||||
* unsigned short *ibufalloc(IMAGE *image);
|
||||
* int ifilbuf(IMAGE *image);
|
||||
* int iflush(IMAGE *image);
|
||||
* unsigned int iflsbuf(IMAGE *image, unsigned int c);
|
||||
* void isetname(IMAGE *image, char *name);
|
||||
* void isetcolormap(IMAGE *image, int colormap);
|
||||
*/
|
||||
|
||||
int iclose(IMAGE *image);
|
||||
int putrow(IMAGE *image, unsigned short *buffer, unsigned int y, unsigned int z);
|
||||
int getrow(IMAGE *image, unsigned short *buffer, unsigned int y, unsigned int z);
|
||||
|
||||
/*
|
||||
IMAGE *iopen();
|
||||
IMAGE *icreate();
|
||||
*/
|
||||
|
||||
unsigned short *ibufalloc();
|
||||
|
||||
#define IMAGEDEF /* for backwards compatibility */
|
||||
#ifdef __cplusplus
|
||||
}
|
||||
#endif
|
||||
#endif /* !__GL_IMAGE_H__ */
|
||||
@@ -0,0 +1,105 @@
|
||||
#ifndef _RAMROM_H
|
||||
#define _RAMROM_H
|
||||
|
||||
/**************************************************************************
|
||||
* *
|
||||
* Copyright (C) 1994, Silicon Graphics, Inc. *
|
||||
* *
|
||||
* These coded instructions, statements, and computer programs contain *
|
||||
* unpublished proprietary information of Silicon Graphics, Inc., and *
|
||||
* are protected by Federal copyright law. They may not be disclosed *
|
||||
* to third parties or copied or duplicated in any form, in whole or *
|
||||
* in part, without the prior written consent of Silicon Graphics, Inc. *
|
||||
* *
|
||||
**************************************************************************/
|
||||
|
||||
/*
|
||||
* Defines for the GIO card in the Nintendo Development Station
|
||||
*
|
||||
* The RAM on the GIO card acts as ROM for the game
|
||||
* Interrupts available between the game and the Indy host
|
||||
*
|
||||
* The last part of the ramrom is used for communication between
|
||||
* game and host. There are 6 4K buffers defined:
|
||||
* log, printf, rmon to indy, rmon from indy, app to indy, app from indy
|
||||
* The last 8 bytes of the buffer are used in the emulator environment
|
||||
*/
|
||||
|
||||
#define RAMROM_SIZE (0x1000000)
|
||||
|
||||
#define RAMROM_BUF_SIZE (4096)
|
||||
#define RAMROM_MSG_SIZE (RAMROM_BUF_SIZE*6)
|
||||
#define RAMROM_MSG_ADDR (RAMROM_SIZE - RAMROM_MSG_SIZE)
|
||||
#define RAMROM_MSG_HDR_SIZE (3*sizeof(long))
|
||||
#define RAMROM_USER_DATA_SIZE (RAMROM_MSG_SIZE-RAMROM_MSG_HDR_SIZE)
|
||||
|
||||
#define RAMROM_APP_READ_ADDR (RAMROM_MSG_ADDR + (0*RAMROM_BUF_SIZE))
|
||||
#define RAMROM_APP_WRITE_ADDR (RAMROM_MSG_ADDR + (1*RAMROM_BUF_SIZE))
|
||||
#define RAMROM_RMON_READ_ADDR (RAMROM_MSG_ADDR + (2*RAMROM_BUF_SIZE))
|
||||
#define RAMROM_RMON_WRITE_ADDR (RAMROM_MSG_ADDR + (3*RAMROM_BUF_SIZE))
|
||||
#define RAMROM_PRINTF_ADDR (RAMROM_MSG_ADDR + (4*RAMROM_BUF_SIZE))
|
||||
#define RAMROM_LOG_ADDR (RAMROM_MSG_ADDR + (5*RAMROM_BUF_SIZE))
|
||||
|
||||
/*#define RAMROM_GIO_INTERRUPT (RAMROM_MSG_ADDR + RAMROM_MSG_SIZE - 4)*/
|
||||
|
||||
/*
|
||||
* For the initial round of PIF bringup, we will load in a bootstrap loader
|
||||
* 0x400 bytes into the ramrom, and the rom will be loaded at 0x2000
|
||||
*/
|
||||
#ifndef _HW_VERSION_1
|
||||
#define RAMROM_BOOTSTRAP_OFFSET 0x40
|
||||
#define RAMROM_GAME_OFFSET 0x1000
|
||||
#define RAMROM_FONTDATA_OFFSET 0xb70
|
||||
#define RAMROM_FONTDATA_SIZE 1152
|
||||
#else
|
||||
#define RAMROM_BOOTSTRAP_OFFSET 0x400
|
||||
#define RAMROM_GAME_OFFSET 0x2000
|
||||
#endif
|
||||
#define RAMROM_CLOCKRATE_OFFSET 0x4
|
||||
#define RAMROM_CLOCKRATE_MASK 0xfffffff0
|
||||
#define RAMROM_BOOTADDR_OFFSET 0x8
|
||||
#define RAMROM_RELEASE_OFFSET 0xc
|
||||
/*
|
||||
* Second version of the PIF jumps to location 0x1000, and we'll put a jump to
|
||||
* location 0x400 into the ramrom (for backwards compatibility).
|
||||
*/
|
||||
#define RAMROM_PIF2BOOTSTRAP_OFFSET 0x1000
|
||||
|
||||
typedef struct {
|
||||
long type;
|
||||
long length; /* in bytes of userdata */
|
||||
long magic;
|
||||
char userdata[RAMROM_USER_DATA_SIZE];
|
||||
} RamRomBuffer;
|
||||
|
||||
/*
|
||||
* Interrupt values (must fit in 6 bits!)
|
||||
* values are used for both request & response
|
||||
* Transactions initiated by the host start with HOST
|
||||
* and those initiated by the target start with GAME.
|
||||
*/
|
||||
|
||||
#define HOST_PIACCESS_REQ 1
|
||||
#define HOST_DBG_CMD_READY 2
|
||||
#define GAME_DBG_DATA_SEND 3
|
||||
#define HOST_DBG_DATA_ACK 4
|
||||
#define GAME_PRINTF_SEND 5
|
||||
#define HOST_PRINTF_ACK 6
|
||||
#define GAME_LOG_SEND 7
|
||||
#define HOST_LOG_ACK 8
|
||||
#define HOST_APP_CMD_READY 9
|
||||
#define GAME_APP_DATA_READY 10
|
||||
#define HOST_PROF_REQ 11
|
||||
#define GAME_PROF_SEND 12
|
||||
#define HOST_PROF_ACK 13
|
||||
#define GAME_FAULT_SEND 14
|
||||
#define HOST_FAULT_ACK 15
|
||||
#define GAME_EXIT 16
|
||||
#define HOST_DATA_ACK 17
|
||||
|
||||
#ifdef _EMULATOR
|
||||
void __RamRomInit(int key, void *romaddr);
|
||||
void __RamRomDestroy(int key);
|
||||
#endif /* _EMULATOR */
|
||||
|
||||
#endif /* !_RAMROM_H */
|
||||
@@ -0,0 +1,84 @@
|
||||
#ifndef _RDB_H
|
||||
#define _RDB_H
|
||||
|
||||
/* U64 side address */
|
||||
#define RDB_BASE_REG 0xc0000000
|
||||
#define RDB_WRITE_INTR_REG (RDB_BASE_REG + 0x8)
|
||||
#define RDB_READ_INTR_REG (RDB_BASE_REG + 0xc)
|
||||
#define RDB_BASE_VIRTUAL_ADDR 0x80000000
|
||||
|
||||
/* packet type Have six bits, so can have up to 63 types */
|
||||
#define RDB_TYPE_INVALID 0
|
||||
#define RDB_TYPE_GtoH_PRINT 1
|
||||
#define RDB_TYPE_GtoH_FAULT 2
|
||||
#define RDB_TYPE_GtoH_LOG_CT 3
|
||||
#define RDB_TYPE_GtoH_LOG 4
|
||||
#define RDB_TYPE_GtoH_READY_FOR_DATA 5
|
||||
#define RDB_TYPE_GtoH_DATA_CT 6
|
||||
#define RDB_TYPE_GtoH_DATA 7
|
||||
#define RDB_TYPE_GtoH_DEBUG 8
|
||||
#define RDB_TYPE_GtoH_RAMROM 9
|
||||
#define RDB_TYPE_GtoH_DEBUG_DONE 10
|
||||
#define RDB_TYPE_GtoH_DEBUG_READY 11
|
||||
#define RDB_TYPE_GtoH_KDEBUG 12
|
||||
#define RDB_TYPE_GtoH_PROF_DATA 22
|
||||
|
||||
|
||||
#define RDB_TYPE_HtoG_LOG_DONE 13
|
||||
#define RDB_TYPE_HtoG_DEBUG 14
|
||||
#define RDB_TYPE_HtoG_DEBUG_CT 15
|
||||
#define RDB_TYPE_HtoG_DATA 16
|
||||
#define RDB_TYPE_HtoG_DATA_DONE 17
|
||||
#define RDB_TYPE_HtoG_REQ_RAMROM 18
|
||||
#define RDB_TYPE_HtoG_FREE_RAMROM 19
|
||||
#define RDB_TYPE_HtoG_KDEBUG 20
|
||||
#define RDB_TYPE_HtoG_PROF_SIGNAL 21
|
||||
|
||||
|
||||
#define RDB_PROF_ACK_SIG 1
|
||||
#define RDB_PROF_FLUSH_SIG 2
|
||||
#define PROF_BLOCK_SIZE 2048
|
||||
|
||||
#define RDB_LOG_MAX_BLOCK_SIZE 0x8000
|
||||
#define RDB_DATA_MAX_BLOCK_SIZE 0x8000
|
||||
|
||||
|
||||
/* GIO side address */
|
||||
#define GIO_RDB_BASE_REG 0xbf480000
|
||||
#define GIO_RDB_WRITE_INTR_REG (GIO_RDB_BASE_REG + 0x8)
|
||||
#define GIO_RDB_READ_INTR_REG (GIO_RDB_BASE_REG + 0xc)
|
||||
|
||||
/* minor device number */
|
||||
#define GIO_RDB_PRINT_MINOR 1
|
||||
#define GIO_RDB_DEBUG_MINOR 2
|
||||
|
||||
/* interrupt bit */
|
||||
#define GIO_RDB_WRITE_INTR_BIT 0x80000000
|
||||
#define GIO_RDB_READ_INTR_BIT 0x40000000
|
||||
|
||||
/* debug command */
|
||||
#define DEBUG_COMMAND_NULL 0
|
||||
#define DEBUG_COMMAND_MEMORY 1
|
||||
#define DEBUG_COMMAND_REGISTER 2
|
||||
#define DEBUG_COMMAND_INVALID 255
|
||||
|
||||
/* debug state */
|
||||
#define DEBUG_STATE_NULL 0
|
||||
#define DEBUG_STATE_RECEIVE 1
|
||||
#define DEBUG_STATE_INVALID 255
|
||||
|
||||
#if defined(_LANGUAGE_C) || defined(_LANGUAGE_C_PLUS_PLUS)
|
||||
|
||||
/* Structure for debug port */
|
||||
typedef struct {
|
||||
unsigned type : 6; /* 0: invalid, 1: print, 2: debug */
|
||||
unsigned length : 2; /* 1, 2, or 3 */
|
||||
char buf[3]; /* character buffer */
|
||||
} rdbPacket;
|
||||
|
||||
extern unsigned int __osRdbWriteOK;
|
||||
extern unsigned int __osRdbSendMessage;
|
||||
|
||||
#endif /* _LANGUAGE_C */
|
||||
|
||||
#endif /* !_RDB_H */
|
||||
@@ -0,0 +1,123 @@
|
||||
|
||||
/**************************************************************************
|
||||
* *
|
||||
* Copyright (C) 1994, Silicon Graphics, Inc. *
|
||||
* *
|
||||
* These coded instructions, statements, and computer programs contain *
|
||||
* unpublished proprietary information of Silicon Graphics, Inc., and *
|
||||
* are protected by Federal copyright law. They may not be disclosed *
|
||||
* to third parties or copied or duplicated in any form, in whole or *
|
||||
* in part, without the prior written consent of Silicon Graphics, Inc. *
|
||||
* *
|
||||
**************************************************************************/
|
||||
|
||||
/**************************************************************************
|
||||
*
|
||||
* Module: region.h
|
||||
*
|
||||
* $Revision: 1.7 $
|
||||
* $Date: 1995/06/07 05:11:42 $
|
||||
* $Author: chn $
|
||||
* $Source: /mdev2/PR/include/RCS/region.h,v $
|
||||
*
|
||||
* Description:
|
||||
* This file contains macros and structure definitions for the region
|
||||
* library.
|
||||
*
|
||||
**************************************************************************/
|
||||
|
||||
|
||||
#ifndef _REGION_H_
|
||||
#define _REGION_H_
|
||||
|
||||
|
||||
#ifdef _LANGUAGE_C_PLUS_PLUS
|
||||
extern "C" {
|
||||
#endif
|
||||
|
||||
#include <PR/ultratypes.h>
|
||||
|
||||
|
||||
/***************************************
|
||||
*
|
||||
* Global defines
|
||||
*
|
||||
*/
|
||||
/* Alignment sizes */
|
||||
#define ALIGNSZ (sizeof(long long)) /* 8 bytes */
|
||||
#define ALIGNOFFST (ALIGNSZ-1)
|
||||
|
||||
/* size for storing index to free buffer */
|
||||
#define BUF_CTRL_SIZE ALIGNSZ
|
||||
|
||||
/* Max bufcount = 32K */
|
||||
#define MAX_BUFCOUNT 0x8000
|
||||
/* code for last free buffer */
|
||||
#define BUF_FREE_WO_NEXT 0x8000
|
||||
|
||||
/*
|
||||
* Global defines for alignment size (default is 8-byte alignment)
|
||||
*/
|
||||
#define OS_RG_ALIGN_2B 2 /* 2 bytes = 16-bit alignment */
|
||||
#define OS_RG_ALIGN_4B 4 /* 4 bytes = 32-bit alignment */
|
||||
#define OS_RG_ALIGN_8B 8 /* 8 bytes = 64-bit alignment */
|
||||
#define OS_RG_ALIGN_16B 16 /* 16 bytes = 128-bit alignment */
|
||||
|
||||
#define OS_RG_ALIGN_DEFAULT OS_RG_ALIGN_8B
|
||||
|
||||
|
||||
/***************************************
|
||||
*
|
||||
* Macro definitions
|
||||
*
|
||||
*/
|
||||
|
||||
/* Perform alignment on input 's' */
|
||||
#define ALIGN(s, align) (((u32)(s) + (align-1)) & ~(align-1))
|
||||
|
||||
|
||||
/***************************************
|
||||
*
|
||||
* Typedefs & structure definitions
|
||||
*
|
||||
*/
|
||||
/*
|
||||
* Structure for region header/control area
|
||||
*/
|
||||
typedef struct _Region_s {
|
||||
u8 *r_startBufferAddress; /* start address to data buffer */
|
||||
u8 *r_endAddress; /* end address of region */
|
||||
s32 r_bufferSize; /* size of buffers for this region */
|
||||
s32 r_bufferCount; /* up to 32K entries; MSB is used for
|
||||
setting end-of-list/used */
|
||||
u16 r_freeList; /* point to array index of first
|
||||
available memory buffer */
|
||||
u16 r_alignSize; /* alignment size (# of bytes) */
|
||||
} OSRegion;
|
||||
|
||||
/*
|
||||
* Macro to simplify accessing region header structure
|
||||
*/
|
||||
#define RP(x) rp->r_##x
|
||||
|
||||
|
||||
/***************************************
|
||||
*
|
||||
* Function prototypes
|
||||
*
|
||||
*/
|
||||
extern void *osCreateRegion(void *, u32, u32, u32);
|
||||
extern void *osMalloc(void *);
|
||||
extern void osFree(void *, void *);
|
||||
extern s32 osGetRegionBufCount(void *);
|
||||
extern s32 osGetRegionBufSize(void *);
|
||||
|
||||
|
||||
#ifdef _LANGUAGE_C_PLUS_PLUS
|
||||
}
|
||||
#endif
|
||||
|
||||
|
||||
#endif /* _REGION_H_ */
|
||||
|
||||
|
||||
@@ -0,0 +1,31 @@
|
||||
/**************************************************************************
|
||||
* *
|
||||
* Copyright (C) 1995, Silicon Graphics, Inc. *
|
||||
* *
|
||||
* These coded instructions, statements, and computer programs contain *
|
||||
* unpublished proprietary information of Silicon Graphics, Inc., and *
|
||||
* are protected by Federal copyright law. They may not be disclosed *
|
||||
* to third parties or copied or duplicated in any form, in whole or *
|
||||
* in part, without the prior written consent of Silicon Graphics, Inc. *
|
||||
* *
|
||||
**************************************************************************/
|
||||
|
||||
#ifndef _RMON_H_
|
||||
#define _RMON_H_
|
||||
|
||||
#ifdef _LANGUAGE_C_PLUS_PLUS
|
||||
extern "C" {
|
||||
#endif
|
||||
|
||||
#include <PR/ultratypes.h>
|
||||
#define RMON_DBG_BUF_SIZE 2048
|
||||
#define RMON_STACKSIZE 0x1000
|
||||
|
||||
extern void rmonMain( void * );
|
||||
extern void rmonPrintf( const char *, ... );
|
||||
|
||||
#ifdef _LANGUAGE_C_PLUS_PLUS
|
||||
}
|
||||
#endif
|
||||
|
||||
#endif /* !_OS_H */
|
||||
+64
-3
@@ -8,12 +8,20 @@
|
||||
#define M_HVQTASK 6
|
||||
#define M_HVQMTASK 7
|
||||
|
||||
/**
|
||||
* Size of Yield buffer. The taskHdrPtr->t.yield_data_ptr must point to a
|
||||
* buffer of this size. (The size is in bytes). ONLY If the task will NEVER
|
||||
* yield it may be a null pointer. The buffer must be aligned to a 64 bit
|
||||
* boundary. The taskHdrPtr->t.yield_data_ptr must be set to point to the
|
||||
* buffer BEFORE the task is started.
|
||||
*/
|
||||
#if (defined(F3DEX_GBI) || defined(F3DLP_GBI) || defined(F3DEX_GBI_2))
|
||||
#define OS_YIELD_DATA_SIZE 0xc00
|
||||
#else
|
||||
#define OS_YIELD_DATA_SIZE 0x900
|
||||
#endif
|
||||
#define OS_YIELD_AUDIO_SIZE 0x400
|
||||
#define OS_YIELD_GFX_DATA_SIZE 0xBA0
|
||||
|
||||
/* Flags */
|
||||
#define M_TASK_FLAG0 1
|
||||
@@ -22,6 +30,18 @@
|
||||
#define M_TASK_FLAG2 4
|
||||
#endif
|
||||
|
||||
/*
|
||||
* Task Flags field
|
||||
*/
|
||||
#define OS_TASK_YIELDED 0x0001
|
||||
#define OS_TASK_DP_WAIT 0x0002
|
||||
#define OS_TASK_LOADABLE 0x0004
|
||||
#define OS_TASK_SP_ONLY 0x0008
|
||||
#define OS_TASK_USR0 0x0010
|
||||
#define OS_TASK_USR1 0x0020
|
||||
#define OS_TASK_USR2 0x0040
|
||||
#define OS_TASK_USR3 0x0080
|
||||
|
||||
/* SpStatus */
|
||||
#define SPSTATUS_CLEAR_HALT 0x00000001
|
||||
#define SPSTATUS_SET_HALT 0x00000002
|
||||
@@ -65,9 +85,50 @@
|
||||
#define SPSTATUS_SIGNAL6_SET 0x2000
|
||||
#define SPSTATUS_SIGNAL7_SET 0x4000
|
||||
|
||||
/* Types */
|
||||
/* Types */
|
||||
|
||||
// =================================================================================================
|
||||
//
|
||||
// Type definitions
|
||||
//
|
||||
//
|
||||
|
||||
/*
|
||||
* Task List Structure.
|
||||
*
|
||||
* Things an app might pass to the SP via the task list.
|
||||
* Not every task ucode would need/use every field, but
|
||||
*
|
||||
* - type (audio, gfx, video, ...)
|
||||
* - flags
|
||||
* - wait for DP to drain before running new task
|
||||
* - SEE BIT DEFINITIONS UNDER "Task Flags field"
|
||||
* - pointer to boot ucode
|
||||
* - size of boot ucode
|
||||
* - pointer to ucode
|
||||
* - size of ucode
|
||||
* - pointer to initial DMEM data
|
||||
* - size of initial DMEM data
|
||||
* - pointer to DRAM stack
|
||||
* - size of DRAM stack (max)
|
||||
* - pointer to output buffer
|
||||
* - pointer to store output buffer length
|
||||
* - generic data pointer (for display list, etc.)
|
||||
* - generic data length (for display list, etc.)
|
||||
* - pointer to buffer where to store saved DMEM (in yield case)
|
||||
* - size of buffer to store saved DMEM.
|
||||
*
|
||||
* IMPORTANT!!! Watch alignment issues.
|
||||
*
|
||||
* IMPORTANT!!! Watch data cache issues. The RCP may write data into the
|
||||
* dram_stack, output_buff, output_buff_size, and the yield_data_ptr areas.
|
||||
* These buffers should be cache aligned and use the entire line (16 bytes) to
|
||||
* avoid corruption by writebacks by the CPU (cache tearing).
|
||||
*
|
||||
* IMPORTANT!!! all addresses are virtual addresses. Library does
|
||||
* any necessary translation.
|
||||
*
|
||||
* documentation copied from n64devkit\ultra\usr\include\PR\sptask.h
|
||||
*/
|
||||
typedef struct
|
||||
{
|
||||
/*0x00*/ u32 type;
|
||||
@@ -86,7 +147,7 @@ typedef struct
|
||||
/*0x24*/ u32 dram_stack_size;
|
||||
|
||||
/*0x28*/ u64 *output_buff;
|
||||
/*0x2C*/ u64 *output_buff_size;
|
||||
/*0x2C*/ u64 *output_buff_size; // why is this u64*
|
||||
|
||||
/*0x30*/ u64 *data_ptr;
|
||||
/*0x34*/ u32 data_size;
|
||||
|
||||
@@ -0,0 +1,165 @@
|
||||
/*====================================================================
|
||||
* ultraerror.h
|
||||
*
|
||||
* Copyright 1995, Silicon Graphics, Inc.
|
||||
* All Rights Reserved.
|
||||
*
|
||||
* This is UNPUBLISHED PROPRIETARY SOURCE CODE of Silicon Graphics,
|
||||
* Inc.; the contents of this file may not be disclosed to third
|
||||
* parties, copied or duplicated in any form, in whole or in part,
|
||||
* without the prior written permission of Silicon Graphics, Inc.
|
||||
*
|
||||
* RESTRICTED RIGHTS LEGEND:
|
||||
* Use, duplication or disclosure by the Government is subject to
|
||||
* restrictions as set forth in subdivision (c)(1)(ii) of the Rights
|
||||
* in Technical Data and Computer Software clause at DFARS
|
||||
* 252.227-7013, and/or in similar or successor clauses in the FAR,
|
||||
* DOD or NASA FAR Supplement. Unpublished - rights reserved under the
|
||||
* Copyright Laws of the United States.
|
||||
*====================================================================*/
|
||||
|
||||
/**************************************************************************
|
||||
*
|
||||
* $Revision: 1.23 $
|
||||
* $Date: 1997/02/11 08:38:08 $
|
||||
* $Source: /disk6/Master/cvsmdev2/PR/include/ultraerror.h,v $
|
||||
*
|
||||
**************************************************************************/
|
||||
|
||||
#ifndef __ULTRAERROR_H__
|
||||
#define __ULTRAERROR_H__
|
||||
|
||||
#ifdef _LANGUAGE_C_PLUS_PLUS
|
||||
extern "C" {
|
||||
#endif
|
||||
|
||||
#include <PR/ultratypes.h>
|
||||
|
||||
#define OS_ERROR_FMT "/usr/lib/PR/error.fmt"
|
||||
#define OS_ERROR_MAGIC 0x6b617479
|
||||
|
||||
/* OS error codes */
|
||||
|
||||
#define ERR_OSCREATETHREAD_SP 1
|
||||
#define ERR_OSCREATETHREAD_PRI 2
|
||||
#define ERR_OSSTARTTHREAD 3
|
||||
#define ERR_OSSETTHREADPRI 4
|
||||
#define ERR_OSCREATEMESGQUEUE 5
|
||||
#define ERR_OSSENDMESG 6
|
||||
#define ERR_OSJAMMESG 7
|
||||
#define ERR_OSRECVMESG 8
|
||||
#define ERR_OSSETEVENTMESG 9
|
||||
#define ERR_OSMAPTLB_INDEX 10
|
||||
#define ERR_OSMAPTLB_ASID 11
|
||||
#define ERR_OSUNMAPTLB 12
|
||||
#define ERR_OSSETTLBASID 13
|
||||
#define ERR_OSAISETFREQUENCY 14
|
||||
#define ERR_OSAISETNEXTBUFFER_ADDR 15
|
||||
#define ERR_OSAISETNEXTBUFFER_SIZE 16
|
||||
#define ERR_OSDPSETNEXTBUFFER_ADDR 17
|
||||
#define ERR_OSDPSETNEXTBUFFER_SIZE 18
|
||||
#define ERR_OSPIRAWREADIO 19
|
||||
#define ERR_OSPIRAWWRITEIO 20
|
||||
#define ERR_OSPIRAWSTARTDMA_DIR 21
|
||||
#define ERR_OSPIRAWSTARTDMA_DEVADDR 22
|
||||
#define ERR_OSPIRAWSTARTDMA_ADDR 23
|
||||
#define ERR_OSPIRAWSTARTDMA_SIZE 24
|
||||
#define ERR_OSPIRAWSTARTDMA_RANGE 25
|
||||
#define ERR_OSPIREADIO 26
|
||||
#define ERR_OSPIWRITEIO 27
|
||||
#define ERR_OSPISTARTDMA_PIMGR 28
|
||||
#define ERR_OSPISTARTDMA_PRI 29
|
||||
#define ERR_OSPISTARTDMA_DIR 30
|
||||
#define ERR_OSPISTARTDMA_DEVADDR 31
|
||||
#define ERR_OSPISTARTDMA_ADDR 32
|
||||
#define ERR_OSPISTARTDMA_SIZE 33
|
||||
#define ERR_OSPISTARTDMA_RANGE 34
|
||||
#define ERR_OSCREATEPIMANAGER 35
|
||||
#define ERR_OSVIGETCURRENTMODE 36
|
||||
#define ERR_OSVIGETCURRENTFRAMEBUFFER 37
|
||||
#define ERR_OSVIGETNEXTFRAMEBUFFER 38
|
||||
#define ERR_OSVISETXSCALE_VALUE 39
|
||||
#define ERR_OSVISETXSCALE_VIMGR 40
|
||||
#define ERR_OSVISETYSCALE_VALUE 41
|
||||
#define ERR_OSVISETYSCALE_VIMGR 42
|
||||
#define ERR_OSVISETSPECIAL_VALUE 43
|
||||
#define ERR_OSVISETSPECIAL_VIMGR 44
|
||||
#define ERR_OSVISETMODE 45
|
||||
#define ERR_OSVISETEVENT 46
|
||||
#define ERR_OSVISWAPBUFFER_ADDR 47
|
||||
#define ERR_OSVISWAPBUFFER_VIMGR 48
|
||||
#define ERR_OSCREATEVIMANAGER 49
|
||||
#define ERR_OSCREATEREGION_ALIGN 50
|
||||
#define ERR_OSCREATEREGION_SIZE 51
|
||||
#define ERR_OSMALLOC 52
|
||||
#define ERR_OSFREE_REGION 53
|
||||
#define ERR_OSFREE_ADDR 54
|
||||
#define ERR_OSGETREGIONBUFCOUNT 55
|
||||
#define ERR_OSGETREGIONBUFSIZE 56
|
||||
#define ERR_OSSPTASKLOAD_DRAM 57
|
||||
#define ERR_OSSPTASKLOAD_OUT 58
|
||||
#define ERR_OSSPTASKLOAD_OUTSIZE 59
|
||||
#define ERR_OSSPTASKLOAD_YIELD 60
|
||||
#define ERR_OSPROFILEINIT_STR 61
|
||||
#define ERR_OSPROFILEINIT_CNT 62
|
||||
#define ERR_OSPROFILEINIT_ALN 63
|
||||
#define ERR_OSPROFILEINIT_ORD 64
|
||||
#define ERR_OSPROFILEINIT_SIZ 65
|
||||
#define ERR_OSPROFILESTART_TIME 66
|
||||
#define ERR_OSPROFILESTART_FLAG 67
|
||||
#define ERR_OSPROFILESTOP_FLAG 68
|
||||
#define ERR_OSPROFILESTOP_TIMER 69
|
||||
#define ERR_OSREADHOST_ADDR 70
|
||||
#define ERR_OSREADHOST_SIZE 71
|
||||
#define ERR_OSWRITEHOST_ADDR 72
|
||||
#define ERR_OSWRITEHOST_SIZE 73
|
||||
#define ERR_OSGETTIME 74
|
||||
#define ERR_OSSETTIME 75
|
||||
#define ERR_OSSETTIMER 76
|
||||
#define ERR_OSSTOPTIMER 77
|
||||
#define ERR_ALSEQP_NO_SOUND 100
|
||||
#define ERR_ALSEQP_NO_VOICE 101
|
||||
#define ERR_ALSEQP_MAP_VOICE 102
|
||||
#define ERR_ALSEQP_OFF_VOICE 103
|
||||
#define ERR_ALSEQP_POLY_VOICE 104
|
||||
#define ERR_ALSNDP_NO_VOICE 105
|
||||
#define ERR_ALSYN_NO_UPDATE 106
|
||||
#define ERR_ALSNDPDEALLOCATE 107
|
||||
#define ERR_ALSNDPDELETE 108
|
||||
#define ERR_ALSNDPPLAY 109
|
||||
#define ERR_ALSNDPSETSOUND 110
|
||||
#define ERR_ALSNDPSETPRIORITY 111
|
||||
#define ERR_ALSNDPSETPAR 112
|
||||
#define ERR_ALBNKFNEW 113
|
||||
#define ERR_ALSEQNOTMIDI 114
|
||||
#define ERR_ALSEQNOTMIDI0 115
|
||||
#define ERR_ALSEQNUMTRACKS 116
|
||||
#define ERR_ALSEQTIME 117
|
||||
#define ERR_ALSEQTRACKHDR 118
|
||||
#define ERR_ALSEQSYSEX 119
|
||||
#define ERR_ALSEQMETA 120
|
||||
#define ERR_ALSEQPINVALIDPROG 121
|
||||
#define ERR_ALSEQPUNKNOWNMIDI 122
|
||||
#define ERR_ALSEQPUNMAP 123
|
||||
#define ERR_ALEVENTNOFREE 124
|
||||
#define ERR_ALHEAPNOFREE 125
|
||||
#define ERR_ALHEAPCORRUPT 126
|
||||
#define ERR_ALHEAPFIRSTBLOCK 127
|
||||
#define ERR_ALCSEQZEROSTATUS 128
|
||||
#define ERR_ALCSEQZEROVEL 129
|
||||
#define ERR_ALCSPVNOTFREE 130
|
||||
#define ERR_ALSEQOVERRUN 131
|
||||
#define ERR_OSAISETNEXTBUFFER_ENDADDR 132
|
||||
#define ERR_ALMODDELAYOVERFLOW 133
|
||||
|
||||
#if defined(_LANGUAGE_C) || defined(_LANGUAGE_C_PLUS_PLUS)
|
||||
typedef void (*OSErrorHandler)(s16, s16, ...);
|
||||
|
||||
OSErrorHandler osSetErrorHandler(OSErrorHandler);
|
||||
#endif
|
||||
|
||||
#ifdef _LANGUAGE_C_PLUS_PLUS
|
||||
}
|
||||
#endif
|
||||
|
||||
#endif /* __ULTRAERROR_H__ */
|
||||
+74
-34
@@ -1,44 +1,84 @@
|
||||
#ifndef _ULTRA64_TYPES_H_
|
||||
#define _ULTRA64_TYPES_H_
|
||||
|
||||
/**************************************************************************
|
||||
* *
|
||||
* Copyright (C) 1995, Silicon Graphics, Inc. *
|
||||
* *
|
||||
* These coded instructions, statements, and computer programs contain *
|
||||
* unpublished proprietary information of Silicon Graphics, Inc., and *
|
||||
* are protected by Federal copyright law. They may not be disclosed *
|
||||
* to third parties or copied or duplicated in any form, in whole or *
|
||||
* in part, without the prior written consent of Silicon Graphics, Inc. *
|
||||
* *
|
||||
**************************************************************************/
|
||||
|
||||
/*************************************************************************
|
||||
*
|
||||
* File: ultratypes.h
|
||||
*
|
||||
* This file contains various types used in Ultra64 interfaces.
|
||||
*
|
||||
* $Header: /mdev2/PR/include/RCS/ultratypes.h,v 1.4 1995/03/29 00:52:13 jeffd Exp $
|
||||
*
|
||||
*/
|
||||
|
||||
/**********************************************************************
|
||||
* General data types for R4300
|
||||
*/
|
||||
#if defined(_LANGUAGE_C) || defined(_LANGUAGE_C_PLUS_PLUS)
|
||||
|
||||
typedef unsigned char u8; /* unsigned 8-bit */
|
||||
typedef unsigned short u16; /* unsigned 16-bit */
|
||||
typedef unsigned int u32; /* unsigned 32-bit */
|
||||
typedef unsigned long long u64; /* unsigned 64-bit */
|
||||
|
||||
typedef signed char s8; /* signed 8-bit */
|
||||
typedef short s16; /* signed 16-bit */
|
||||
typedef int s32; /* signed 32-bit */
|
||||
typedef long long s64; /* signed 64-bit */
|
||||
|
||||
typedef volatile unsigned char vu8; /* unsigned 8-bit */
|
||||
typedef volatile unsigned short vu16; /* unsigned 16-bit */
|
||||
typedef volatile unsigned int vu32; /* unsigned 32-bit */
|
||||
typedef volatile unsigned long long vu64; /* unsigned 64-bit */
|
||||
|
||||
typedef volatile signed char vs8; /* signed 8-bit */
|
||||
typedef volatile short vs16; /* signed 16-bit */
|
||||
typedef volatile int vs32; /* signed 32-bit */
|
||||
typedef volatile long long vs64; /* signed 64-bit */
|
||||
|
||||
typedef float f32; /* single prec floating point */
|
||||
typedef double f64; /* double prec floating point */
|
||||
|
||||
#endif /* _LANGUAGE_C */
|
||||
|
||||
/*************************************************************************
|
||||
* Common definitions
|
||||
*/
|
||||
#ifndef TRUE
|
||||
# define TRUE 1
|
||||
#endif
|
||||
|
||||
#ifndef FALSE
|
||||
# define FALSE 0
|
||||
#endif
|
||||
|
||||
#ifndef NULL
|
||||
#define NULL (void *)0
|
||||
# define NULL (void *)0
|
||||
#endif
|
||||
|
||||
#define TRUE 1
|
||||
#define FALSE 0
|
||||
|
||||
typedef signed char s8;
|
||||
typedef unsigned char u8;
|
||||
typedef signed short int s16;
|
||||
typedef unsigned short int u16;
|
||||
typedef signed int s32;
|
||||
typedef unsigned int u32;
|
||||
typedef signed long long int s64;
|
||||
typedef unsigned long long int u64;
|
||||
|
||||
typedef volatile u8 vu8;
|
||||
typedef volatile u16 vu16;
|
||||
typedef volatile u32 vu32;
|
||||
typedef volatile u64 vu64;
|
||||
typedef volatile s8 vs8;
|
||||
typedef volatile s16 vs16;
|
||||
typedef volatile s32 vs32;
|
||||
typedef volatile s64 vs64;
|
||||
|
||||
typedef float f32;
|
||||
typedef double f64;
|
||||
|
||||
//this section is from stddef.h and should go back there
|
||||
#ifdef TARGET_N64
|
||||
typedef u32 size_t;
|
||||
typedef s32 ssize_t;
|
||||
typedef u32 uintptr_t;
|
||||
typedef s32 intptr_t;
|
||||
typedef s32 ptrdiff_t;
|
||||
typedef u32 size_t;
|
||||
typedef s32 ssize_t;
|
||||
typedef u32 uintptr_t;
|
||||
typedef s32 intptr_t;
|
||||
typedef s32 ptrdiff_t;
|
||||
#else
|
||||
#include <stddef.h>
|
||||
#include <stdint.h>
|
||||
typedef ptrdiff_t ssize_t;
|
||||
#include <stddef.h>
|
||||
#include <stdint.h>
|
||||
typedef ptrdiff_t ssize_t;
|
||||
#endif
|
||||
|
||||
#endif
|
||||
#endif /* _ULTRATYPES_H_ */
|
||||
@@ -0,0 +1,57 @@
|
||||
#ifndef __ASSERT_H__
|
||||
#define __ASSERT_H__
|
||||
#ifdef __cplusplus
|
||||
extern "C" {
|
||||
#endif
|
||||
/**************************************************************************
|
||||
* *
|
||||
* Copyright (C) 1984, Silicon Graphics, Inc. *
|
||||
* *
|
||||
* These coded instructions, statements, and computer programs contain *
|
||||
* unpublished proprietary information of Silicon Graphics, Inc., and *
|
||||
* are protected by Federal copyright law. They may not be disclosed *
|
||||
* to third parties or copied or duplicated in any form, in whole or *
|
||||
* in part, without the prior written consent of Silicon Graphics, Inc. *
|
||||
* *
|
||||
**************************************************************************/
|
||||
/* Copyright (c) 1984 AT&T */
|
||||
/* All Rights Reserved */
|
||||
|
||||
/* THIS IS UNPUBLISHED PROPRIETARY SOURCE CODE OF AT&T */
|
||||
/* The copyright notice above does not evidence any */
|
||||
/* actual or intended publication of such source code. */
|
||||
|
||||
#ident "$Revision: 1.17 $"
|
||||
|
||||
/* ANSI C Notes:
|
||||
*
|
||||
* - THE IDENTIFIERS APPEARING OUTSIDE OF #ifdef __EXTENSIONS__ IN THIS
|
||||
* standard header ARE SPECIFIED BY ANSI! CONFORMANCE WILL BE ALTERED
|
||||
* IF ANY NEW IDENTIFIERS ARE ADDED TO THIS AREA UNLESS THEY ARE IN ANSI's
|
||||
* RESERVED NAMESPACE. (i.e., unless they are prefixed by __[a-z] or
|
||||
* _[A-Z]. For external objects, identifiers with the prefix _[a-z]
|
||||
* are also reserved.)
|
||||
*/
|
||||
|
||||
#ifdef NDEBUG
|
||||
#undef assert
|
||||
#define assert(EX) ((void)0)
|
||||
|
||||
#else
|
||||
|
||||
extern void osSyncPrintf(const char *fmt, ...);
|
||||
#define assert(EX) if(!(EX))osSyncPrintf("\n--- ASSERTION FAULT - %s - %s, line %d\n\n", # EX , __FILE__, __LINE__)
|
||||
|
||||
// extern void __assert(const char *, const char *, int);
|
||||
// #ifdef __ANSI_CPP__
|
||||
// #define assert(EX) ((EX)?((void)0):__assert( # EX , __FILE__, __LINE__))
|
||||
// #else
|
||||
// #define assert(EX) ((EX)?((void)0):__assert("EX", __FILE__, __LINE__))
|
||||
// #endif
|
||||
#endif /* NDEBUG */
|
||||
|
||||
#ifdef __cplusplus
|
||||
}
|
||||
#endif
|
||||
|
||||
#endif /* !__ASSERT_H__ */
|
||||
@@ -0,0 +1,35 @@
|
||||
#ifndef __BSTRING_H__
|
||||
#define __BSTRING_H__
|
||||
#ifdef __cplusplus
|
||||
extern "C" {
|
||||
#endif
|
||||
|
||||
/*
|
||||
* bstring(3C) -- byte string operations
|
||||
*
|
||||
* Copyright 1990, Silicon Graphics, Inc.
|
||||
* All Rights Reserved.
|
||||
*
|
||||
* This is UNPUBLISHED PROPRIETARY SOURCE CODE of Silicon Graphics, Inc.;
|
||||
* the contents of this file may not be disclosed to third parties, copied or
|
||||
* duplicated in any form, in whole or in part, without the prior written
|
||||
* permission of Silicon Graphics, Inc.
|
||||
*
|
||||
* RESTRICTED RIGHTS LEGEND:
|
||||
* Use, duplication or disclosure by the Government is subject to restrictions
|
||||
* as set forth in subdivision (c)(1)(ii) of the Rights in Technical Data
|
||||
* and Computer Software clause at DFARS 252.227-7013, and/or in similar or
|
||||
* successor clauses in the FAR, DOD or NASA FAR Supplement. Unpublished -
|
||||
* rights reserved under the Copyright Laws of the United States.
|
||||
*/
|
||||
|
||||
#ident "$Revision: 1.4 $"
|
||||
|
||||
extern void bcopy(const void *, void *, int);
|
||||
extern int bcmp(const void *, const void *, int);
|
||||
extern void bzero(void *, int);
|
||||
|
||||
#ifdef __cplusplus
|
||||
}
|
||||
#endif
|
||||
#endif /* !__BSTRING_H__ */
|
||||
@@ -0,0 +1,222 @@
|
||||
#ifndef _GBI_EXT_H_
|
||||
# define _GBI_EXT_H_
|
||||
#include <PR/gbi.h>
|
||||
|
||||
#define TRI4_Ext
|
||||
|
||||
/**
|
||||
* This file should contain most of the extensions to gbi avoiding loosing
|
||||
* changes should the OS ever be updated.
|
||||
*/
|
||||
|
||||
/**
|
||||
These are some helper constants. Since they relate to nothing else except GBI
|
||||
macros, Ill place them here, to save reserving names that might be used
|
||||
elsewhere - though doubtfull.
|
||||
*/
|
||||
#define MASK_2 1
|
||||
#define MASK_4 2
|
||||
#define MASK_8 3
|
||||
#define MASK_16 4
|
||||
#define MASK_32 5
|
||||
#define MASK_64 6
|
||||
#define MASK_128 7
|
||||
#define MASK_256 8
|
||||
#define MASK_512 9
|
||||
#define MASK_1024 10
|
||||
|
||||
/* Set the Texel Scale (0.0 - 1.0) for multiplying UV's eg, 0.5 * (31 << 6) = 31.0 */
|
||||
#define CALC_TEXSCALE(scale) scale < 1.0f ? scale * 0x10000 : 0xffff
|
||||
|
||||
/* Set the Lower Right S Coordinate using texture width */
|
||||
#define CALC_LRS(width, height, siz) ((((width) * (height) + siz##_INCR) >> siz##_SHIFT) - 1)
|
||||
|
||||
#define CALC_TILESIZE(texel) ((texel)-1) << G_TEXTURE_IMAGE_FRAC
|
||||
|
||||
|
||||
|
||||
#ifdef TRI4_Ext
|
||||
# define G_TRI4 (G_IMMFIRST - 14)
|
||||
# define G_SETTEX 0xc0 /* 0 */
|
||||
#endif
|
||||
|
||||
/* Fade Modes ... for GE? */
|
||||
#define G_CC_MODULATEIFADE TEXEL0, 0, SHADE, 0, 0, 0, 0, ENVIRONMENT
|
||||
#define G_CC_MODULATERGBFADE G_CC_MODULATEIFADE
|
||||
#define G_CC_MODULATEIFADEA TEXEL0, 0, SHADE, 0, TEXEL0, 0, ENVIRONMENT, 0
|
||||
#define G_CC_MODULATEFADE TEXEL0, 0, SHADE, 0, ENVIRONMENT, 0, TEXEL0, 0
|
||||
#define G_CC_MODULATERGBFADEA G_CC_MODULATEIFADEA
|
||||
#define G_CC_FADE SHADE, 0, ENVIRONMENT, 0, SHADE, 0, ENVIRONMENT, 0
|
||||
#define G_CC_FADEA TEXEL0, 0, ENVIRONMENT, 0, TEXEL0, 0, ENVIRONMENT, 0
|
||||
#define G_CC_DECALFADE 0, 0, 0, TEXEL0, 0, 0, 0, ENVIRONMENT
|
||||
#define G_CC_DECALFADEA 0, 0, 0, TEXEL0, TEXEL0, 0, ENVIRONMENT, 0
|
||||
#define G_CC_BLENDRGBFADEA TEXEL0, SHADE, TEXEL0_ALPHA, SHADE, 0, 0, 0, ENVIRONMENT
|
||||
#define G_CC_ADDRGBFADE TEXEL0, 0, TEXEL0, SHADE, 0, 0, 0, ENVIRONMENT
|
||||
#define G_CC_SHADEFADEA 0, 0, 0, SHADE, 0, 0, 0, ENVIRONMENT
|
||||
|
||||
|
||||
/* Custom version of RM_AA_ZB_XLU_SURF with Z_UPD */
|
||||
#define RM_CUSTOM_AA_ZB_XLU_SURF(clk) \
|
||||
RM_AA_ZB_XLU_SURF(clk) | Z_UPD
|
||||
|
||||
|
||||
|
||||
#define G_RM_CUSTOM_AA_ZB_XLU_SURF RM_CUSTOM_AA_ZB_XLU_SURF(1)
|
||||
#define G_RM_CUSTOM_AA_ZB_XLU_SURF2 RM_CUSTOM_AA_ZB_XLU_SURF(2)
|
||||
|
||||
|
||||
#ifdef TRI4_Ext
|
||||
/***
|
||||
*** 4 Triangles
|
||||
***/
|
||||
|
||||
//cannot use 2tri with 4tri, so lets just make sure they are undefined so errors happen.
|
||||
#undef gSP2Triangles
|
||||
#undef gsSP2Triangles
|
||||
|
||||
/**
|
||||
Draw up to 4 triangles at a time.
|
||||
Vertex index is 0-15, to use a higher index use gSP1Triangle
|
||||
*/
|
||||
#define gSP4Triangles(pkt, x1, y1, z1, x2, y2, z2, x3, y3, z3, x4, y4, z4) \
|
||||
{ \
|
||||
Gfx *_g = (Gfx *)(pkt); \
|
||||
\
|
||||
_g->words.w0 = (_SHIFTL(G_TRI4, 24, 8) \
|
||||
| _SHIFTL(z4, 12, 4) \
|
||||
| _SHIFTL(z3, 8, 4) \
|
||||
| _SHIFTL(z2, 4, 4) \
|
||||
| _SHIFTL(z1, 0, 4)); \
|
||||
_g->words.w1 = (_SHIFTL(y4, 28, 4) \
|
||||
| _SHIFTL(x4, 24, 4) \
|
||||
| _SHIFTL(y3, 20, 4) \
|
||||
| _SHIFTL(x3, 16, 4) \
|
||||
| _SHIFTL(y2, 12, 4) \
|
||||
| _SHIFTL(x2, 8, 4) \
|
||||
| _SHIFTL(y1, 4, 4) \
|
||||
| _SHIFTL(x1, 0, 4)); \
|
||||
}
|
||||
|
||||
/**
|
||||
Draw up to 4 triangles at a time.
|
||||
Vertex index is 0-15, to use a higher index use gSP1Triangle
|
||||
*/
|
||||
#define gsSP4Triangles(x1, y1, z1, x2, y2, z2, x3, y3, z3, x4, y4, z4) \
|
||||
{ \
|
||||
{ \
|
||||
(_SHIFTL(G_TRI4, 24, 8) \
|
||||
| _SHIFTL(z4, 12, 4) \
|
||||
| _SHIFTL(z3, 8, 4) \
|
||||
| _SHIFTL(z2, 4, 4) \
|
||||
| _SHIFTL(z1, 0, 4)), \
|
||||
(_SHIFTL(y4, 28, 4) \
|
||||
| _SHIFTL(x4, 24, 4) \
|
||||
| _SHIFTL(y3, 20, 4) \
|
||||
| _SHIFTL(x3, 16, 4) \
|
||||
| _SHIFTL(y2, 12, 4) \
|
||||
| _SHIFTL(x2, 8, 4) \
|
||||
| _SHIFTL(y1, 4, 4) \
|
||||
| _SHIFTL(x1, 0, 4)) \
|
||||
} \
|
||||
}
|
||||
|
||||
/**
|
||||
Source compatable F3DEX gSP2Triangles for GE
|
||||
Vertex index is 0-15, to use a higher index use gSP1Triangle
|
||||
*/
|
||||
#define gSP2Triangles(pkt, x1, y1, z1, flag0, x2, y2, z2, flag1) \
|
||||
gSP4Triangles(pkt, x1, y1, z1, x2, y2, z2, 0, 0, 0, 0, 0, 0)
|
||||
#define gsSP2Triangles(x1, y1, z1, flag0, x2, y2, z2, flag1) \
|
||||
gsSP4Triangles(x1, y1, z1, x2, y2, z2, 0, 0, 0, 0, 0, 0)
|
||||
|
||||
|
||||
/*
|
||||
* Texturing macro Overrides
|
||||
*/
|
||||
|
||||
#define gsSPUseTexture()\
|
||||
{ \
|
||||
{ \
|
||||
(_SHIFTL(G_SETTEX, 24, 8) | \
|
||||
/*STUFF GOES HERE*/), \
|
||||
/*STUFF GOES HERE*/ \
|
||||
} \
|
||||
}
|
||||
|
||||
|
||||
#endif
|
||||
|
||||
/**
|
||||
* Like gDPSetPrimColor, but is useful when the input colour is already in
|
||||
* RGBA format. It avoids unnecessary bitshifting and masking.
|
||||
*/
|
||||
#define gDPSetPrimColorViaWord(pkt, m, l, rgba) \
|
||||
{ \
|
||||
Gfx *_g = (Gfx *)(pkt); \
|
||||
_g->words.w0 = (_SHIFTL(G_SETPRIMCOLOR, 24, 8) \
|
||||
| _SHIFTL(m, 8, 8) \
|
||||
| _SHIFTL(l, 0, 8)); \
|
||||
_g->words.w1 = (rgba); \
|
||||
}
|
||||
|
||||
#define gDPSetEnvColorViaWord(pkt, rgba) gDPSetColor(pkt, G_SETENVCOLOR, rgba)
|
||||
#define gDPSetFogColorViaWord(pkt, rgba) gDPSetColor(pkt, G_SETFOGCOLOR, rgba)
|
||||
|
||||
|
||||
|
||||
#if 0 //Rare - so far - didnt seem to use this
|
||||
#undef gDPLoadTextureBlock
|
||||
/**
|
||||
Override of Load Texture Block without the PipeSync.
|
||||
Loads a Texture and sets its tile
|
||||
@param timg: Address of the texture image. E.g. IMAGESEG(IMAGE_SMOKE_0)
|
||||
@param fmt: Texture image format: E.g. G_IM_FMT_IA
|
||||
@param siz: Pixel component size: E.g. G_IM_SIZ_8b
|
||||
@param width: Texture image width
|
||||
@param height: Texture image height
|
||||
@param pal: Location of palette for 4-bit color index texture (0 - 15)
|
||||
@param cms: s-axis mirror, no-mirror, wrap, and clamp flags
|
||||
@param cmt: t-axis mirror, no-mirror, wrap, and clamp flags
|
||||
@param masks: s-axis mask (0 - 15 or G_TX_NOMASK)
|
||||
@param maskt: t-axis mask (0 - 15 or G_TX_NOMASK)
|
||||
@param shifts: s-coordinate shift value or G_TX_NOLOD
|
||||
@param shiftt: t-coordinate shift value or G_TX_NOLOD
|
||||
*/
|
||||
#define gDPLoadTextureBlock(pkt, timg, fmt, siz, width, height, pal, cms, cmt, masks, maskt, shifts, shiftt) \
|
||||
{ \
|
||||
gDPSetTextureImage(pkt, fmt, siz##_LOAD_BLOCK, 1, timg); \
|
||||
gDPSetTile(pkt, fmt, siz##_LOAD_BLOCK, 0, 0, G_TX_LOADTILE, 0, cmt, maskt, shiftt, cms, masks, shifts); \
|
||||
gDPLoadSync(pkt); \
|
||||
gDPLoadBlock(pkt, G_TX_LOADTILE, 0, 0, (((width) * (height) + siz##_INCR) >> siz##_SHIFT) - 1, CALC_DXT(width, siz##_BYTES)); \
|
||||
gDPSetTile(pkt, fmt, siz, (((width)*siz##_LINE_BYTES) + 7) >> 3, 0, G_TX_RENDERTILE, pal, cmt, maskt, shiftt, cms, masks, shifts); \
|
||||
gDPSetTileSize(pkt, G_TX_RENDERTILE, 0, 0, ((width)-1) << G_TEXTURE_IMAGE_FRAC, ((height)-1) << G_TEXTURE_IMAGE_FRAC) \
|
||||
}
|
||||
|
||||
#undef gsDPLoadTextureBlock
|
||||
/**
|
||||
Override of Load Texture Block (static) without the PipeSync.
|
||||
Loads a Texture and sets its tile
|
||||
@param timg: Address of the texture image. E.g. IMAGESEG(IMAGE_SMOKE_0)
|
||||
@param fmt: Texture image format: E.g. G_IM_FMT_IA
|
||||
@param siz: Pixel component size: E.g. G_IM_SIZ_8b
|
||||
@param width: Texture image width
|
||||
@param height: Texture image height
|
||||
@param pal: Location of palette for 4-bit color index texture (0 - 15)
|
||||
@param cms: s-axis mirror, no-mirror, wrap, and clamp flags
|
||||
@param cmt: t-axis mirror, no-mirror, wrap, and clamp flags
|
||||
@param masks: s-axis mask (0 - 15 or G_TX_NOMASK)
|
||||
@param maskt: t-axis mask (0 - 15 or G_TX_NOMASK)
|
||||
@param shifts: s-coordinate shift value or G_TX_NOLOD
|
||||
@param shiftt: t-coordinate shift value or G_TX_NOLOD
|
||||
*/
|
||||
#define gsDPLoadTextureBlock(timg, fmt, siz, width, height, pal, cms, cmt, masks, maskt, shifts, shiftt) \
|
||||
\
|
||||
gsDPSetTextureImage(fmt, siz##_LOAD_BLOCK, 1, timg), \
|
||||
gsDPSetTile(fmt, siz##_LOAD_BLOCK, 0, 0, G_TX_LOADTILE, 0, cmt, maskt, shiftt, cms, masks, shifts), \
|
||||
gsDPLoadSync(), \
|
||||
gsDPLoadBlock(G_TX_LOADTILE, 0, 0, (((width) * (height) + siz##_INCR) >> siz##_SHIFT) - 1, CALC_DXT(width, siz##_BYTES)), \
|
||||
gsDPSetTile(fmt, siz, ((((width)*siz##_LINE_BYTES) + 7) >> 3), 0, G_TX_RENDERTILE, pal, cmt, maskt, shiftt, cms, masks, shifts), \
|
||||
gsDPSetTileSize(G_TX_RENDERTILE, 0, 0, ((width)-1) << G_TEXTURE_IMAGE_FRAC, ((height)-1) << G_TEXTURE_IMAGE_FRAC)
|
||||
|
||||
#endif
|
||||
#endif
|
||||
@@ -0,0 +1,304 @@
|
||||
#ifndef _LIMITS_H
|
||||
#define _LIMITS_H
|
||||
|
||||
/* Sizes of integral types */
|
||||
#define CHAR_BIT 8 /* max # of bits in a "char" */
|
||||
#define SCHAR_MIN (-128) /* min value of a "signed char" */
|
||||
#define SCHAR_MAX 127 /* max value of a "signed char" */
|
||||
#define UCHAR_MAX 255U /* max value of an "unsigned char" */
|
||||
|
||||
#define MB_LEN_MAX 5
|
||||
|
||||
#define CHAR_MIN 0 /* min value of a "char" */
|
||||
#define CHAR_MAX UCHAR_MAX /* max value of a "char" */
|
||||
|
||||
#define SHRT_MIN (-32768) /* min value of a "short int" */
|
||||
#define SHRT_MAX 32767 /* max value of a "short int" */
|
||||
#define USHRT_MAX 65535U /* max value of an "unsigned short int" */
|
||||
#define INT_MIN (-2147483648) /* min value of an "int" */
|
||||
#define INT_MAX 2147483647 /* max value of an "int" */
|
||||
#define UINT_MAX 4294967295U /* max value of an "unsigned int" */
|
||||
#if (_MIPS_SZLONG == 32)
|
||||
# define LONG_MIN (-2147483648) /* min value of a "long int" */
|
||||
# define LONG_MAX 2147483647 /* max value of a "long int" */
|
||||
# define ULONG_MAX 4294967295U /* max value of an "unsigned long int" */
|
||||
#endif
|
||||
#if (_MIPS_SZLONG == 64)
|
||||
# define LONG_MIN (-9223372036854775807L - 1L) /* min value of a "long int" */
|
||||
# define LONG_MAX 9223372036854775807L /* max value of a "long int" */
|
||||
# define ULONG_MAX 18446744073709551615LU /* max value of an "unsigned long int" */
|
||||
#endif
|
||||
|
||||
#if defined(_SGI_SOURCE) && defined(_LONGLONG) && !defined(_POSIX_SOURCE) && !defined(_XOPEN_SOURCE)
|
||||
# define LONGLONG_MIN (-9223372036854775808LL) /* min "long long int" */
|
||||
# define LONGLONG_MAX 9223372036854775807LL /* max "long long int" */
|
||||
# define ULONGLONG_MAX 18446744073709551615LLU /* max "unsigned long long int" */
|
||||
#endif
|
||||
|
||||
#define DBL_DIG 15 /* digits of precision of a "double" */
|
||||
#define DBL_MAX 1.7976931348623157E+308 /* max decimal value of a "double"*/
|
||||
#define DBL_MIN 2.2250738585072014E-308 /* min decimal value of a "double"*/
|
||||
#define FLT_DIG 6 /* digits of precision of a "float" */
|
||||
#ifdef __STDC__
|
||||
# define FLT_MAX 3.40282347E+38F /* max decimal value of a "float" */
|
||||
# define FLT_MIN 1.17549435E-38F /* min decimal value of a "float" */
|
||||
#else
|
||||
# define FLT_MAX 3.40282347E+38 /* max decimal value of a "float" */
|
||||
# define FLT_MIN 1.17549435E-38 /* min decimal value of a "float" */
|
||||
#endif /* __STDC__ */
|
||||
|
||||
#endif
|
||||
|
||||
#if 0
|
||||
/*
|
||||
*
|
||||
* Copyright 1992, Silicon Graphics, Inc.
|
||||
* All Rights Reserved.
|
||||
*
|
||||
* This is UNPUBLISHED PROPRIETARY SOURCE CODE of Silicon Graphics, Inc.;
|
||||
* the contents of this file may not be disclosed to third parties, copied or
|
||||
* duplicated in any form, in whole or in part, without the prior written
|
||||
* permission of Silicon Graphics, Inc.
|
||||
*
|
||||
* RESTRICTED RIGHTS LEGEND:
|
||||
* Use, duplication or disclosure by the Government is subject to restrictions
|
||||
* as set forth in subdivision (c)(1)(ii) of the Rights in Technical Data
|
||||
* and Computer Software clause at DFARS 252.227-7013, and/or in similar or
|
||||
* successor clauses in the FAR, DOD or NASA FAR Supplement. Unpublished -
|
||||
* rights reserved under the Copyright Laws of the United States.
|
||||
*/
|
||||
/* Copyright (c) 1988 AT&T */
|
||||
/* All Rights Reserved */
|
||||
|
||||
/* THIS IS UNPUBLISHED PROPRIETARY SOURCE CODE OF AT&T */
|
||||
/* The copyright notice above does not evidence any */
|
||||
/* actual or intended publication of such source code. */
|
||||
#ifndef __LIMITS_H__
|
||||
#define __LIMITS_H__
|
||||
|
||||
#ident "$Revision: 7.27 $"
|
||||
#include <sgidefs.h> removed for now, add back later
|
||||
|
||||
#ifdef __cplusplus
|
||||
extern "C"
|
||||
{
|
||||
#endif
|
||||
|
||||
/* Sizes of integral types */
|
||||
#define CHAR_BIT 8 /* max # of bits in a "char" */
|
||||
#define SCHAR_MIN (-128) /* min value of a "signed char" */
|
||||
#define SCHAR_MAX 127 /* max value of a "signed char" */
|
||||
#define UCHAR_MAX 255U /* max value of an "unsigned char" */
|
||||
|
||||
#define MB_LEN_MAX 5
|
||||
|
||||
#define CHAR_MIN 0 /* min value of a "char" */
|
||||
#define CHAR_MAX UCHAR_MAX /* max value of a "char" */
|
||||
|
||||
#define SHRT_MIN (-32768) /* min value of a "short int" */
|
||||
#define SHRT_MAX 32767 /* max value of a "short int" */
|
||||
#define USHRT_MAX 65535U /* max value of an "unsigned short int" */
|
||||
#define INT_MIN (-2147483647 - 1) /* min value of an "int" */
|
||||
#define INT_MAX 2147483647 /* max value of an "int" */
|
||||
#define UINT_MAX 4294967295U /* max value of an "unsigned int" */
|
||||
#if (_MIPS_SZLONG == 32)
|
||||
# define LONG_MIN (-2147483647 - 1) /* min value of a "long int" */
|
||||
# define LONG_MAX 2147483647 /* max value of a "long int" */
|
||||
# define ULONG_MAX 4294967295U /* max value of an "unsigned long int" */
|
||||
#endif
|
||||
#if (_MIPS_SZLONG == 64)
|
||||
# define LONG_MIN (-9223372036854775807L - 1L) /* min value of a "long int" */
|
||||
# define LONG_MAX 9223372036854775807L /* max value of a "long int" */
|
||||
# define ULONG_MAX 18446744073709551615LU /* max value of an "unsigned long int" */
|
||||
#endif
|
||||
|
||||
#if defined(_SGI_SOURCE) && defined(_LONGLONG) && !defined(_POSIX_SOURCE) && !defined(_XOPEN_SOURCE)
|
||||
# define LONGLONG_MIN (-9223372036854775807LL - 1LL) /* min "long long int" */
|
||||
# define LONGLONG_MAX 9223372036854775807LL /* max "long long int" */
|
||||
# define ULONGLONG_MAX 18446744073709551615LLU /* max "unsigned long long int" */
|
||||
#endif
|
||||
|
||||
|
||||
#if defined(_SVR4_SOURCE) || defined(_POSIX_SOURCE) || defined(_XOPEN_SOURCE)
|
||||
|
||||
# define NGROUPS_MAX 16 /* max number of groups for a user */
|
||||
/*
|
||||
* ARG_MAX
|
||||
* CHILD_MAX
|
||||
* OPEN_MAX
|
||||
* STREAM_MAX
|
||||
*
|
||||
* PATH_MAX
|
||||
* NAME_MAX
|
||||
* LINK_MAX
|
||||
* - are available only thru sysconf/pathconf
|
||||
*/
|
||||
|
||||
# ifndef PIPE_BUF
|
||||
# define PIPE_BUF 10240 /* max # bytes atomic in pipe write */
|
||||
# endif
|
||||
|
||||
# define TZNAME_MAX 8 /* max # bytes for time zone name */
|
||||
|
||||
# ifndef TMP_MAX
|
||||
# define TMP_MAX 17576 /* 26 * 26 * 26 */
|
||||
# endif
|
||||
|
||||
/* POSIX conformant definitions - An implementation may define
|
||||
** other symbols which reflect the actual implementation. Alternate
|
||||
** definitions may not be as restrictive as the POSIX definitions.
|
||||
*/
|
||||
|
||||
# define _POSIX_ARG_MAX 4096
|
||||
# define _POSIX_CHILD_MAX 6
|
||||
# define _POSIX_LINK_MAX 8
|
||||
# define _POSIX_MAX_CANON 255
|
||||
# define _POSIX_MAX_INPUT 255
|
||||
# define _POSIX_NAME_MAX 14
|
||||
# define _POSIX_NGROUPS_MAX 0
|
||||
# define _POSIX_OPEN_MAX 16
|
||||
# define _POSIX_PATH_MAX 255
|
||||
# define _POSIX_PIPE_BUF 512
|
||||
# define _POSIX_SSIZE_MAX 32767
|
||||
# define _POSIX_STREAM_MAX 8
|
||||
# define _POSIX_TZNAME_MAX 3
|
||||
|
||||
# ifndef MAX_CANON
|
||||
# define MAX_CANON 256
|
||||
# endif
|
||||
|
||||
# ifndef MAX_INPUT
|
||||
# define MAX_INPUT 512
|
||||
# endif
|
||||
|
||||
# define SSIZE_MAX LONG_MAX /* yes, its an int but this does the \
|
||||
* right thingh for 64 bits */
|
||||
|
||||
#endif
|
||||
|
||||
#if (defined(_SVR4_SOURCE) && !defined(_POSIX_SOURCE)) || defined(_XOPEN_SOURCE)
|
||||
|
||||
# define PASS_MAX 8 /* max # of characters in a password */
|
||||
|
||||
# define NL_ARGMAX 9 /* max value of "digit" in calls to the \
|
||||
* NLS printf() and scanf() */
|
||||
# define NL_LANGMAX 14 /* max # of bytes in a LANG name */
|
||||
# define NL_NMAX 1 /* max # of bytes in N-to-1 mapping characters */
|
||||
/* also defined in nl_types.h */
|
||||
# ifndef NL_SETMAX
|
||||
# define NL_SETMAX 255
|
||||
# define NL_MSGMAX 32767
|
||||
# define NL_TEXTMAX 255
|
||||
# endif
|
||||
# ifndef NZERO
|
||||
# define NZERO 20 /* default process priority */
|
||||
# endif
|
||||
|
||||
# define WORD_BIT 32 /* # of bits in a "word" or "int" */
|
||||
# if (_MIPS_SZLONG == 32)
|
||||
# define LONG_BIT 32 /* # of bits in a "long" */
|
||||
# endif
|
||||
# if (_MIPS_SZLONG == 64)
|
||||
# define LONG_BIT 64 /* # of bits in a "long" */
|
||||
# endif
|
||||
|
||||
# define DBL_DIG 15 /* digits of precision of a "double" */
|
||||
# define DBL_MAX 1.7976931348623157E+308 /* max decimal value of a "double"*/
|
||||
# define DBL_MIN 2.2250738585072014E-308 /* min decimal value of a "double"*/
|
||||
# define FLT_DIG 6 /* digits of precision of a "float" */
|
||||
# ifdef __STDC__
|
||||
# define FLT_MAX 3.40282347E+38F /* max decimal value of a "float" */
|
||||
# define FLT_MIN 1.17549435E-38F /* min decimal value of a "float" */
|
||||
# else
|
||||
# define FLT_MAX 3.40282347E+38 /* max decimal value of a "float" */
|
||||
# define FLT_MIN 1.17549435E-38 /* min decimal value of a "float" */
|
||||
# endif /* __STDC__ */
|
||||
|
||||
#endif /* (_SVR4_SOURCE && !defined(_POSIX_SOURCE)) || defined(_XOPEN_SOURCE) */
|
||||
|
||||
#if defined(_SVR4_SOURCE) && !defined(_POSIX_SOURCE) && !defined(_XOPEN_SOURCE)
|
||||
|
||||
/*
|
||||
* Note that for POSIX/XPG3: ARG_MAX, CHILD_MAX, NAME_MAX, OPEN_MAX, PATH_MAX,
|
||||
* come LINK_MAX only from sysconf/pathconf, but for default environment we
|
||||
* put in backward compatibility defines
|
||||
*/
|
||||
# define FCHR_MAX 2147483647 /* max size of a file in bytes */
|
||||
# define PID_MAX 30000 /* max value for a process ID */
|
||||
# define CHILD_MAX 25 /* max # of processes per user id */
|
||||
# define NAME_MAX 255 /* max # of characters in a file name */
|
||||
# define LINK_MAX 30000 /* max # of links to a single file */
|
||||
|
||||
# ifndef OPEN_MAX
|
||||
# if i386
|
||||
# define OPEN_MAX 60 /* max # of files a process can have open */
|
||||
# else
|
||||
# define OPEN_MAX 20 /* max # of files a process can have open */
|
||||
# endif
|
||||
# endif
|
||||
|
||||
# ifndef PIPE_MAX
|
||||
# define PIPE_MAX 10240 /* max # bytes written to pipe in a wrt */
|
||||
# endif
|
||||
|
||||
# define STD_BLK 1024 /* # bytes in a physical I/O block */
|
||||
# define UID_MAX 60002 /* max value for a user or group ID */
|
||||
# define USI_MAX 4294967295 /* max decimal value of an "unsigned" */
|
||||
# define SYSPID_MAX 1 /* max pid of system processes */
|
||||
|
||||
# ifndef PATH_MAX
|
||||
# define PATH_MAX 1024 /* max # of characters in a path name */
|
||||
# endif
|
||||
# ifndef ARG_MAX
|
||||
# define ARG_MAX 5120
|
||||
# endif
|
||||
|
||||
# if !defined(SYS_NMLN)
|
||||
# define SYS_NMLN 257 /* SVR4.0 size of utsname elements */
|
||||
/* also defined in sys/utsname.h */
|
||||
# endif /* !SYS_NMLN */
|
||||
|
||||
# ifndef CLK_TCK
|
||||
# define CLK_TCK sysconf(3) /* clock ticks per second */
|
||||
/* 3 is _SC_CLK_TCK */
|
||||
# endif
|
||||
|
||||
# define LOGNAME_MAX 8 /* max # of characters in a login name */
|
||||
|
||||
#endif
|
||||
|
||||
#if defined(_SGI_SOURCE) && !defined(_POSIX_SOURCE) && !defined(_XOPEN_SOURCE)
|
||||
# if (defined(_LANGUAGE_C) || defined(_LANGUAGE_C_PLUS_PLUS))
|
||||
# ifndef HUGE_VAL
|
||||
# ifndef __TYPEDEF_H_VAL
|
||||
# define __TYPEDEF_H_VAL
|
||||
typedef union _h_val
|
||||
{
|
||||
# if (_MIPS_SZLONG == 32)
|
||||
unsigned long i[2];
|
||||
# endif
|
||||
# if (_MIPS_SZLONG == 64)
|
||||
__uint32_t i[2];
|
||||
# endif
|
||||
double d;
|
||||
} _h_val;
|
||||
# endif /* __TYPEDEF_H_VAL */
|
||||
extern const _h_val __huge_val;
|
||||
# define HUGE_VAL __huge_val.d
|
||||
# endif /* !HUGE_VAL */
|
||||
# endif /* _LANGUAGE_C || _LANGUAGE_C_PLUS_PLUS */
|
||||
#endif
|
||||
|
||||
#if (defined(_SVR4_SOURCE) || defined(_SGI_SOURCE) || defined(_POSIX_SOURCE)) && !defined(_XOPEN_SOURCE)
|
||||
|
||||
# define _POSIX_AIO_MAX 1 /* number of oustanding async I/O ops */
|
||||
# define _POSIX_AIO_LISTIO_MAX 2 /* number of I/O operations per lio */
|
||||
# define _ABI_AIO_XFER_MAX (128 * 1024)
|
||||
# define _POSIX_RTSIG_MAX 8 /* max RT signals for application use */
|
||||
# define _POSIX_SIGQUEUE_MAX 32 /* max # of queued signals pending */
|
||||
#endif /* _SGI_SOURCE || (_POSIX_SOURCE && !_XOPEN_SOURCE */
|
||||
#ifdef __cplusplus
|
||||
}
|
||||
#endif
|
||||
#endif /* !__LIMITS_H__ */
|
||||
#endif
|
||||
+611
-6
@@ -1,13 +1,618 @@
|
||||
#ifndef _MATH_H_
|
||||
#define _MATH_H_
|
||||
|
||||
#define M_PI 3.14159265358979323846
|
||||
|
||||
float sinf(float);
|
||||
#ifndef _MATH_EXT_H_
|
||||
#define _MATH_EXT_H_
|
||||
|
||||
/* Some useful constants */
|
||||
/* The base of natural logarithms, e.*/
|
||||
#define M_E 2.7182818284590452354
|
||||
/* The base 2 logarithm of e. (log2e)*/
|
||||
#define M_LOG2E 1.4426950408889634074
|
||||
/* The base 10 logarithm of e. (log10e)*/
|
||||
#define M_LOG10E 0.43429448190325182765
|
||||
/* The natural logarithm of 2. (ln 2)*/
|
||||
#define M_LN2 0.69314718055994530942
|
||||
/* The natural logarithm of 10. (ln 10)*/
|
||||
#define M_LN10 2.30258509299404568402
|
||||
/* The circumference of a circle with diameter 1, PI.*/
|
||||
#define M_PI 3.14159265358979323846
|
||||
/* Half of PI. (PI/2)*/
|
||||
#define M_PI_2 1.57079632679489661923
|
||||
/* A quarter of PI. (PI/4)*/
|
||||
#define M_PI_4 0.78539816339744830962
|
||||
/* The inverse of PI. (1/PI)*/
|
||||
#define M_1_PI 0.31830988618379067154
|
||||
/* Twice the inverse of PI. (2/PI)*/
|
||||
#define M_2_PI 0.63661977236758134308
|
||||
/* The inverse of the square root of PI. (2/(sqrtPI))*/
|
||||
#define M_2_SQRTPI 1.12837916709551257390
|
||||
/* The square root of 2. (sqrt2) */
|
||||
#define M_SQRT2 1.41421356237309504880
|
||||
/* The inverse of the square root of 2. 1/(sqrt2)*/
|
||||
#define M_SQRT1_2 0.70710678118654752440
|
||||
|
||||
// extra defines
|
||||
|
||||
/* The circumference of a circle with diameter 1, PI.*/
|
||||
#define M_PI_F 3.1415927f
|
||||
/* The circumference of a circle with diameter 1, PI.*/
|
||||
#define M_MINUS_PI_F -3.1415927f
|
||||
|
||||
/* The circumference of a circle with radius 1, PI*2.*/
|
||||
#define M_TAU 6.28318530717958647692
|
||||
/* The circumference of a circle with radius 1, PI*2.*/
|
||||
#define M_TAU_F 6.2831855f
|
||||
|
||||
|
||||
/* Half of PI. (PI/2)*/
|
||||
#define M_HALF_PI M_PI_F / 2
|
||||
/* 3 Halves of PI. (3*(PI/2))*/
|
||||
#define M_THREE_HALF_PI 3 * M_HALF_PI
|
||||
|
||||
|
||||
#define M_U16_MAX_VALUE_F 65536.0f
|
||||
#define M_U32_MAX_VALUE_F 4294967296.0f
|
||||
/*
|
||||
The difference between 1.0 and the next larger floating point number
|
||||
*/
|
||||
#define FLT_EPSILON 1.19209290E-07F
|
||||
|
||||
/*Inline Math Funcs*/
|
||||
|
||||
|
||||
#define SECS_TO_TIMER60(SECS) (SECS * GAME_TICKRATE)
|
||||
#define MINS_TO_TIMER60(MINS) (SECS_TO_TIMER60(MINS * GAME_TICKRATE))
|
||||
/* Gets the byte representation of an angle (degrees) */
|
||||
#define DEG2BYTE(DEG) (char)(256.0f / 360.0f * (DEG))
|
||||
/* Gets the byte representation of an angle (radians) */
|
||||
#define RAD2BYTE(RAD) (char)(256.0f / M_TAU_F * (RAD))
|
||||
/* Converts an angle from Degrees to Radians */
|
||||
#define DegToRad(DEG) (float)((DEG) * M_TAU_F / 360.0f)
|
||||
/* Converts and halves an angle from Degrees to Radians */
|
||||
#define mDegToHalfRad(x) ((x * M_PI_F) / 360.0f)
|
||||
/* Converts an angle from Radians to Degrees */
|
||||
#define RadToDeg(RAD) (float)((RAD) * (360.0f / M_TAU_F))
|
||||
/* Gets the angle in radians represented by a byte */
|
||||
#define ByteToRadian(Byte) ((Byte * M_TAU_F) * (1.0f / 256.0f))
|
||||
|
||||
/* Macro Versions of functions */
|
||||
|
||||
#define ABS(x) ((x) < 0 ? -(x) : (x)) /* absolute value of x */
|
||||
#define SGN(x) ((x) < 0 ? -1 : (x) > 0 ? 1 : 0)/* sign of x */
|
||||
#define MIN(x, y) ((x) < (y) ? (x) : (y)) /* minimum of x and y */
|
||||
#define MAX(x, y) ((x) > (y) ? (x) : (y)) /* maximum of x and y */
|
||||
#define SQR(x) ((x) * (x)) /* square of x */
|
||||
|
||||
/**
|
||||
* 0.1f
|
||||
*/
|
||||
#define IDO_POINT_ONE 0.10000001f
|
||||
|
||||
float sinf(float);
|
||||
double sin(double);
|
||||
float cosf(float);
|
||||
float cosf(float);
|
||||
double cos(double);
|
||||
|
||||
float sqrtf(float);
|
||||
float sqrtf(float);
|
||||
|
||||
#endif
|
||||
|
||||
#if 0
|
||||
#ifndef __MATH_H__
|
||||
#define __MATH_H__
|
||||
#ifdef __cplusplus
|
||||
extern "C"
|
||||
{
|
||||
#endif
|
||||
#if (!defined(__SGIDEFS_H__) && defined(_COMPILER_VERSION) && (_COMPILER_VERSION >= 400))
|
||||
# include <sgidefs.h>
|
||||
#endif
|
||||
/* Copyright (C) 1989 Silicon Graphics, Inc. All rights reserved. */
|
||||
/* ------------------------------------------------------------------ */
|
||||
/* | Copyright Unpublished, MIPS Computer Systems, Inc. All Rights | */
|
||||
/* | Reserved. This software contains proprietary and confidential | */
|
||||
/* | information of MIPS and its suppliers. Use, disclosure or | */
|
||||
/* | reproduction is prohibited without the prior express written | */
|
||||
/* | consent of MIPS. | */
|
||||
/* ------------------------------------------------------------------ */
|
||||
|
||||
/* #ident "$Revision: 7.28 $" */
|
||||
|
||||
/* ANSI C Notes:
|
||||
*
|
||||
* - THE IDENTIFIERS APPEARING OUTSIDE OF #ifdef __EXTENSIONS__ IN THIS
|
||||
* standard header ARE SPECIFIED BY ANSI! CONFORMANCE WILL BE ALTERED
|
||||
* IF ANY NEW IDENTIFIERS ARE ADDED TO THIS AREA UNLESS THEY ARE IN ANSI's
|
||||
* RESERVED NAMESPACE. (i.e., unless they are prefixed by __[a-z] or
|
||||
* _[A-Z]. For external objects, identifiers with the prefix _[a-z]
|
||||
* are also reserved.)
|
||||
*
|
||||
* - Names created by appending either the suffix 'l' or 'f'
|
||||
* to one of the reserved function names are reserved for the corresponding
|
||||
* single- or extended- precision version of the function.
|
||||
*/
|
||||
|
||||
/* Power C Notes:
|
||||
*
|
||||
* - Power C assumes that all external functions (unless otherwise marked)
|
||||
* might modify global data and therefore calls to such functions can
|
||||
* not be safely concurrentized.
|
||||
*
|
||||
* - The pragma "no side effects" indicates that the named function is
|
||||
* free from such side effects and calls to it can be concurrentized.
|
||||
*
|
||||
* - This pragma has been added below for each function in the math library
|
||||
* which is "safe".
|
||||
*
|
||||
* - The pragma is properly passed on by 'cpp' & 'c++' and ignored by
|
||||
* 'ccom'. It only has meaning to 'pca'.
|
||||
*/
|
||||
|
||||
/*
|
||||
* ANSI-standard functions. Each is listed with
|
||||
* its single-precision counterpart, if it exists.
|
||||
*/
|
||||
#if defined(_XOPEN_SOURCE)
|
||||
|
||||
extern double lgamma(double);
|
||||
# pragma no side effects(lgamma)
|
||||
extern int isnan(double);
|
||||
# pragma no side effects(isnan)
|
||||
|
||||
extern double erf(double);
|
||||
# pragma no side effects(erf)
|
||||
extern double erfc(double);
|
||||
# pragma no side effects(erfc)
|
||||
|
||||
extern double gamma(double);
|
||||
extern double hypot(double, double);
|
||||
# pragma no side effects(hypot)
|
||||
|
||||
extern double j0(double);
|
||||
# pragma no side effects(j0)
|
||||
extern double j1(double);
|
||||
# pragma no side effects(j1)
|
||||
extern double jn(int, double);
|
||||
# pragma no side effects(jn)
|
||||
|
||||
extern double y0(double);
|
||||
# pragma no side effects(y0)
|
||||
extern double y1(double);
|
||||
# pragma no side effects(y1)
|
||||
extern double yn(int, double);
|
||||
# pragma no side effects(yn)
|
||||
|
||||
/* Some useful constants */
|
||||
# define M_E 2.7182818284590452354
|
||||
# define M_LOG2E 1.4426950408889634074
|
||||
# define M_LOG10E 0.43429448190325182765
|
||||
# define M_LN2 0.69314718055994530942
|
||||
# define M_LN10 2.30258509299404568402
|
||||
# define M_PI 3.14159265358979323846
|
||||
# define M_PI_2 1.57079632679489661923
|
||||
# define M_PI_4 0.78539816339744830962
|
||||
# define M_1_PI 0.31830988618379067154
|
||||
# define M_2_PI 0.63661977236758134308
|
||||
# define M_2_SQRTPI 1.12837916709551257390
|
||||
# define M_SQRT2 1.41421356237309504880
|
||||
# define M_SQRT1_2 0.70710678118654752440
|
||||
|
||||
# ifndef _MAXFLOAT
|
||||
# define _MAXFLOAT
|
||||
# define MAXFLOAT ((float)3.40282346638528860e+38)
|
||||
# endif /* _MAXFLOAT */
|
||||
|
||||
extern int signgam;
|
||||
|
||||
#endif /* _XOPEN_SOURCE */
|
||||
|
||||
extern double acos(double);
|
||||
#pragma no side effects(acos)
|
||||
extern float acosf(float);
|
||||
#pragma no side effects(acosf)
|
||||
|
||||
extern double asin(double);
|
||||
#pragma no side effects(asin)
|
||||
extern float asinf(float);
|
||||
#pragma no side effects(asinf)
|
||||
|
||||
extern double atan(double);
|
||||
#pragma no side effects(atan)
|
||||
extern float atanf(float);
|
||||
#pragma no side effects(atanf)
|
||||
|
||||
extern double atan2(double, double);
|
||||
#pragma no side effects(atan2)
|
||||
extern float atan2f(float, float);
|
||||
#pragma no side effects(atan2f)
|
||||
|
||||
extern double cos(double);
|
||||
#pragma no side effects(cos)
|
||||
extern float cosf(float);
|
||||
#pragma no side effects(cosf)
|
||||
|
||||
extern double sin(double);
|
||||
#pragma no side effects(sin)
|
||||
extern float sinf(float);
|
||||
#pragma no side effects(sinf)
|
||||
|
||||
extern double tan(double);
|
||||
#pragma no side effects(tan)
|
||||
extern float tanf(float);
|
||||
#pragma no side effects(tanf)
|
||||
|
||||
extern double cosh(double);
|
||||
#pragma no side effects(cosh)
|
||||
extern float coshf(float);
|
||||
#pragma no side effects(coshf)
|
||||
|
||||
extern double sinh(double);
|
||||
#pragma no side effects(sinh)
|
||||
extern float sinhf(float);
|
||||
#pragma no side effects(sinhf)
|
||||
|
||||
extern double tanh(double);
|
||||
#pragma no side effects(tanh)
|
||||
extern float tanhf(float);
|
||||
#pragma no side effects(tanhf)
|
||||
|
||||
extern double exp(double);
|
||||
#pragma no side effects(exp)
|
||||
extern float expf(float);
|
||||
#pragma no side effects(expf)
|
||||
|
||||
extern double frexp(double, int *);
|
||||
#if 0
|
||||
/* not yet implemented */
|
||||
extern float frexpf(float, int *);
|
||||
#endif
|
||||
|
||||
extern double ldexp(double, int);
|
||||
#if 0
|
||||
/* not yet implemented */
|
||||
extern float ldexpf(float, int);
|
||||
#endif
|
||||
|
||||
extern double log(double);
|
||||
#pragma no side effects(log)
|
||||
extern float logf(float);
|
||||
#pragma no side effects(logf)
|
||||
|
||||
extern double log10(double);
|
||||
#pragma no side effects(log10)
|
||||
extern float log10f(float);
|
||||
#pragma no side effects(log10f)
|
||||
|
||||
extern double modf(double, double *);
|
||||
/* version of modff implemented for completeness only */
|
||||
extern float modff(float, float *);
|
||||
|
||||
extern double pow(double, double);
|
||||
#pragma no side effects(pow)
|
||||
/* version of powf implemented for completeness only */
|
||||
extern float powf(float, float);
|
||||
#pragma no side effects(powf)
|
||||
|
||||
extern double sqrt(double);
|
||||
#pragma no side effects(sqrt)
|
||||
extern float sqrtf(float);
|
||||
#pragma no side effects(sqrtf)
|
||||
|
||||
extern double ceil(double);
|
||||
#pragma no side effects(ceil)
|
||||
extern float ceilf(float);
|
||||
#pragma no side effects(ceilf)
|
||||
|
||||
extern double fabs(double);
|
||||
#pragma no side effects(fabs)
|
||||
/* version of fabsf implemented for completeness only */
|
||||
extern float fabsf(float);
|
||||
#pragma no side effects(fabsf)
|
||||
|
||||
extern double floor(double);
|
||||
#pragma no side effects(floor)
|
||||
extern float floorf(float);
|
||||
#pragma no side effects(floorf)
|
||||
|
||||
extern double fmod(double, double);
|
||||
#pragma no side effects(fmod)
|
||||
/* version of fmodf implemented for completeness only */
|
||||
extern float fmodf(float, float);
|
||||
#pragma no side effects(fmodf)
|
||||
|
||||
#ifndef HUGE_VAL /* Also in limits.h */
|
||||
# ifdef _SVR4_SOURCE
|
||||
# ifndef __TYPEDEF_H_VAL
|
||||
# define __TYPEDEF_H_VAL
|
||||
typedef union _h_val
|
||||
{
|
||||
# if (_MIPS_SZLONG == 32)
|
||||
unsigned long i[2];
|
||||
# endif
|
||||
# if (_MIPS_SZLONG == 64)
|
||||
__uint32_t i[2];
|
||||
# endif
|
||||
double d;
|
||||
} _h_val;
|
||||
# endif /* __TYPEDEF_H_VAL */
|
||||
|
||||
extern const _h_val __huge_val;
|
||||
# define HUGE_VAL __huge_val.d
|
||||
# else
|
||||
/* __infinity is a double-precision variable in libc set to infinity */
|
||||
extern const double __infinity;
|
||||
# define HUGE_VAL __infinity
|
||||
# endif /* _SVR4_SOURCE */
|
||||
#endif /* !HUGE_VAL */
|
||||
|
||||
#if (defined(__EXTENSIONS__) || defined(_POSIX_SOURCE))
|
||||
extern int errno, signgam;
|
||||
|
||||
extern double atof(const char *);
|
||||
extern int rand(void);
|
||||
extern void srand(unsigned);
|
||||
#endif /* __EXTENSIONS__ || _POSIX_SOURCE */
|
||||
|
||||
#if (defined(__EXTENSIONS__) && (!defined(_POSIX_SOURCE) && !defined(_XOPEN_SOURCE)))
|
||||
|
||||
enum version
|
||||
{
|
||||
c_issue_4,
|
||||
ansi_1,
|
||||
strict_ansi
|
||||
};
|
||||
extern const enum version _lib_version;
|
||||
|
||||
/* Features from 4.3BSD */
|
||||
extern double rint(double);
|
||||
# pragma no side effects(rint)
|
||||
extern double asinh(double);
|
||||
# pragma no side effects(asinh)
|
||||
extern double acosh(double);
|
||||
# pragma no side effects(acosh)
|
||||
extern double atanh(double);
|
||||
# pragma no side effects(atanh)
|
||||
extern double log1p(double);
|
||||
# pragma no side effects(log1p)
|
||||
extern double erf(double);
|
||||
# pragma no side effects(erf)
|
||||
extern double erfc(double);
|
||||
# pragma no side effects(erfc)
|
||||
extern double expm1(double);
|
||||
# pragma no side effects(expm1)
|
||||
extern double gamma(double);
|
||||
extern double hypot(double, double);
|
||||
# pragma no side effects(hypot)
|
||||
struct __cabs_s
|
||||
{
|
||||
double a, b;
|
||||
};
|
||||
extern double cabs(struct __cabs_s);
|
||||
# pragma no side effects(cabs)
|
||||
extern double copysign(double, double);
|
||||
# pragma no side effects(copysign)
|
||||
extern double drem(double, double);
|
||||
# pragma no side effects(drem)
|
||||
extern double logb(double);
|
||||
# pragma no side effects(logb)
|
||||
# if (defined(_COMPILER_VERSION) && (_COMPILER_VERSION >= 400))
|
||||
extern double nextafter(double, double);
|
||||
# pragma no side effects(nextafter)
|
||||
extern double remainder(double, double);
|
||||
# pragma no side effects(remainder)
|
||||
# endif
|
||||
extern double scalb(double, double);
|
||||
# pragma no side effects(scalb)
|
||||
extern int finite(double);
|
||||
# pragma no side effects(finite)
|
||||
extern double j0(double);
|
||||
# pragma no side effects(j0)
|
||||
extern double j1(double);
|
||||
# pragma no side effects(j1)
|
||||
extern double jn(int, double);
|
||||
# pragma no side effects(jn)
|
||||
extern double y0(double);
|
||||
# pragma no side effects(y0)
|
||||
extern double y1(double);
|
||||
# pragma no side effects(y1)
|
||||
extern double yn(int, double);
|
||||
# pragma no side effects(yn)
|
||||
extern double cbrt(double);
|
||||
# pragma no side effects(cbrt)
|
||||
extern double atof(const char *);
|
||||
extern double strtod(const char *, char **);
|
||||
extern double trunc(double);
|
||||
# pragma no side effects(trunc)
|
||||
|
||||
extern int rand(void);
|
||||
extern void srand(unsigned);
|
||||
|
||||
extern long random(void);
|
||||
extern int srandom(unsigned); /* doesn't return a value -- should be void */
|
||||
extern char * initstate(unsigned int, char *, int);
|
||||
extern char * setstate(char *);
|
||||
|
||||
extern double drand48(void);
|
||||
extern double erand48(unsigned short[3]);
|
||||
extern long lrand48(void);
|
||||
extern long nrand48(unsigned short[3]);
|
||||
extern long mrand48(void);
|
||||
extern long jrand48(unsigned short[3]);
|
||||
extern void srand48(long);
|
||||
extern unsigned short *seed48(const unsigned short[3]);
|
||||
extern void lcong48(const unsigned short[7]);
|
||||
|
||||
/* Map old MIPS names of single-precision forms to ANSI names.*/
|
||||
|
||||
# define facos acosf
|
||||
# define fasin asinf
|
||||
# define fatan atanf
|
||||
# define fatan2 atan2f
|
||||
# define fcos cosf
|
||||
# define fsin sinf
|
||||
# define ftan tanf
|
||||
# define fcosh coshf
|
||||
# define fsinh sinhf
|
||||
# define ftanh tanhf
|
||||
# define fexp expf
|
||||
# define flog logf
|
||||
# define flog10 log10f
|
||||
# define fsqrt sqrtf
|
||||
# define fceil ceilf
|
||||
# define ffloor floorf
|
||||
|
||||
/* similar mapping of old MIPS names to ANSI-like names */
|
||||
# undef flog1p
|
||||
# define flog1p log1pf
|
||||
# define ftrunc truncf
|
||||
|
||||
# ifdef __cplusplus
|
||||
# ifndef _ABS_
|
||||
# define _ABS_
|
||||
inline int abs(int x)
|
||||
{
|
||||
return x > 0 ? x : -x;
|
||||
}
|
||||
# endif
|
||||
# endif
|
||||
|
||||
/* additional single-percision forms */
|
||||
extern float fhypot(float, float);
|
||||
# pragma no side effects(fhypot)
|
||||
extern float hypotf(float, float);
|
||||
# pragma no side effects(hypotf)
|
||||
struct __fcabs_s
|
||||
{
|
||||
float a, b;
|
||||
};
|
||||
extern float fcabs(struct __fcabs_s);
|
||||
# pragma no side effects(fcabs)
|
||||
extern float fexpm1(float);
|
||||
# pragma no side effects(fexpm1)
|
||||
extern float expm1f(float);
|
||||
# pragma no side effects(expm1f)
|
||||
extern float log1pf(float);
|
||||
# pragma no side effects(log1pf)
|
||||
extern float truncf(float);
|
||||
# pragma no side effects(truncf)
|
||||
# if (defined(__INLINE_INTRINSICS) && defined(_COMPILER_VERSION) && (_COMPILER_VERSION >= 400))
|
||||
# if _MIPS_ISA != _MIPS_ISA_MIPS1
|
||||
# pragma intrinsic(hypotf)
|
||||
# pragma intrinsic(fhypot)
|
||||
# endif
|
||||
# endif
|
||||
|
||||
# if 0 /* These are not implemented yet. */
|
||||
extern float ferf(float);
|
||||
extern float ferfc(float);
|
||||
extern float flgamma(float);
|
||||
extern float fcopysign(float, float);
|
||||
extern float fdrem(float, float);
|
||||
extern float flogb(float);
|
||||
extern float fscalb(float, int);
|
||||
extern int ffinite(float);
|
||||
extern float fj0(float);
|
||||
extern float fj1(float);
|
||||
extern float fjn(int, float);
|
||||
extern float fy0(float);
|
||||
extern float fy1(float);
|
||||
extern float fyn(int, float);
|
||||
extern float fatof(char *);
|
||||
extern float frint(float);
|
||||
extern float facosh(float);
|
||||
extern float fatanh(float);
|
||||
extern float fcbrt(float);
|
||||
# endif /* 0 */
|
||||
|
||||
/* Some useful constants */
|
||||
/* The base of natural logarithms, e.*/
|
||||
# define M_E 2.7182818284590452354
|
||||
/* The base 2 logarithm of e. (log2e)*/
|
||||
# define M_LOG2E 1.4426950408889634074
|
||||
/* The base 10 logarithm of e. (log10e)*/
|
||||
# define M_LOG10E 0.43429448190325182765
|
||||
/* The natural logarithm of 2. (ln 2)*/
|
||||
# define M_LN2 0.69314718055994530942
|
||||
/* The natural logarithm of 10. (ln 10)*/
|
||||
# define M_LN10 2.30258509299404568402
|
||||
/* The circumference of a circle with diameter 1, PI.*/
|
||||
# define M_PI 3.14159265358979323846
|
||||
/* Half of PI. (?/2)*/
|
||||
# define M_PI_2 1.57079632679489661923
|
||||
/* A quarter of PI. (?/4)*/
|
||||
# define M_PI_4 0.78539816339744830962
|
||||
/* The inverse of PI. (1/?)*/
|
||||
# define M_1_PI 0.31830988618379067154
|
||||
/* Twice the inverse of PI. (2/?)*/
|
||||
# define M_2_PI 0.63661977236758134308
|
||||
/* The inverse of the square root of PI. (2/(??))*/
|
||||
# define M_2_SQRTPI 1.12837916709551257390
|
||||
/* The square root of 2. (?2) */
|
||||
# define M_SQRT2 1.41421356237309504880
|
||||
/* The inverse of the square root of 2. 1/(?2)*/
|
||||
# define M_SQRT1_2 0.70710678118654752440
|
||||
|
||||
# ifndef HUGE
|
||||
# ifdef MAXFLOAT
|
||||
# define HUGE MAXFLOAT
|
||||
# else
|
||||
# define HUGE ((float)3.40282346638528860e+38) /* value of MAXFLOAT */
|
||||
# endif /* MAXFLOAT */
|
||||
# endif /* !HUGE */
|
||||
|
||||
# define _ABS(x) ((x) < 0 ? -(x) : (x))
|
||||
# define _REDUCE(TYPE, X, XN, C1, C2) \
|
||||
{ \
|
||||
double x1 = (double)(TYPE)X, x2 = X - x1; \
|
||||
X = x1 - (XN) * (C1); \
|
||||
X += x2; \
|
||||
X -= (XN) * (C2); \
|
||||
}
|
||||
# define _POLY1(x, c) ((c)[0] * (x) + (c)[1])
|
||||
# define _POLY2(x, c) (_POLY1((x), (c)) * (x) + (c)[2])
|
||||
# define _POLY3(x, c) (_POLY2((x), (c)) * (x) + (c)[3])
|
||||
# define _POLY4(x, c) (_POLY3((x), (c)) * (x) + (c)[4])
|
||||
# define _POLY5(x, c) (_POLY4((x), (c)) * (x) + (c)[5])
|
||||
# define _POLY6(x, c) (_POLY5((x), (c)) * (x) + (c)[6])
|
||||
# define _POLY7(x, c) (_POLY6((x), (c)) * (x) + (c)[7])
|
||||
# define _POLY8(x, c) (_POLY7((x), (c)) * (x) + (c)[8])
|
||||
# define _POLY9(x, c) (_POLY8((x), (c)) * (x) + (c)[9])
|
||||
|
||||
struct exception
|
||||
{
|
||||
int type;
|
||||
char * name;
|
||||
double arg1;
|
||||
double arg2;
|
||||
double retval;
|
||||
};
|
||||
|
||||
extern int matherr(struct exception *p);
|
||||
|
||||
# include <svr4_math.h>
|
||||
|
||||
#endif /* __EXTENSIONS__ && !_POSIX_SOURCE */
|
||||
|
||||
#ifdef __INLINE_INTRINSICS
|
||||
/* The functions made intrinsic here can be activated by the driver
|
||||
** passing -D__INLINE_INTRINSICS to cfe, but cfe should ensure that
|
||||
** this has no effect unless the hardware architecture directly
|
||||
** supports these basic operations.
|
||||
*/
|
||||
# if _MIPS_ISA != _MIPS_ISA_MIPS1
|
||||
# pragma intrinsic(sqrt)
|
||||
# pragma intrinsic(sqrtf)
|
||||
# if (defined(_COMPILER_VERSION) && (_COMPILER_VERSION >= 400))
|
||||
# pragma intrinsic(pow)
|
||||
# pragma intrinsic(powf)
|
||||
# endif
|
||||
# endif
|
||||
# pragma intrinsic(fabs)
|
||||
# pragma intrinsic(fabsf)
|
||||
#endif
|
||||
|
||||
#ifdef __cplusplus
|
||||
}
|
||||
#endif
|
||||
#endif /* !__MATH_H__ */
|
||||
#endif
|
||||
@@ -0,0 +1,26 @@
|
||||
#ifndef _OS_EXTENSION_H_
|
||||
#define _OS_EXTENSION_H_
|
||||
|
||||
/* ******************************************************************************** */
|
||||
// controller
|
||||
/* ******************************************************************************** */
|
||||
#define ANY_BUTTON 0xFFFF
|
||||
|
||||
/* ******************************************************************************** */
|
||||
// audio
|
||||
/* ******************************************************************************** */
|
||||
|
||||
#define AL_USEC_PER_FRAME_60FPS 16000
|
||||
#define AL_USEC_PER_FRAME_30FPS 33000
|
||||
|
||||
// Used while iterating during AL_SNDP_PLAY_EVT;
|
||||
// Seems to be used to flag visited ALEvents.
|
||||
#define AL_UNKOWN_3 3
|
||||
|
||||
// Maybe: call to alSynAllocVoice failed
|
||||
#define AL_UNKOWN_4 4
|
||||
|
||||
// Maybe: currently initializing state?
|
||||
#define AL_UNKOWN_5 5
|
||||
|
||||
#endif
|
||||
@@ -0,0 +1,3 @@
|
||||
This directory should contain libultra version G include/ files and folders.
|
||||
|
||||
Some of these files have been modified (slightly) by Rare.
|
||||
@@ -0,0 +1,189 @@
|
||||
/**************************************************************************
|
||||
* *
|
||||
* Copyright (C) 1991-1992 Silicon Graphics, Inc. *
|
||||
* *
|
||||
* These coded instructions, statements, and computer programs contain *
|
||||
* unpublished proprietary information of Silicon Graphics, Inc., and *
|
||||
* are protected by Federal copyright law. They may not be disclosed *
|
||||
* to third parties or copied or duplicated in any form, in whole or *
|
||||
* in part, without the prior written consent of Silicon Graphics, Inc. *
|
||||
* *
|
||||
**************************************************************************/
|
||||
#ifndef __SGIDEFS_H__
|
||||
#define __SGIDEFS_H__
|
||||
|
||||
#ifdef __cplusplus
|
||||
extern "C" {
|
||||
#endif
|
||||
|
||||
#ident "$Revision: 1.5 $"
|
||||
|
||||
/*
|
||||
* sgidefs.h - SGI/MIPS basic software generation system constants & types
|
||||
*
|
||||
* This file MUST be includable in any language
|
||||
* and in the 'C' case must be ANSI compliant
|
||||
* In particular this means NO long long ...
|
||||
*
|
||||
* Constants and types defined here are to support
|
||||
* multi-isa (instruction set architecture) coding
|
||||
*
|
||||
* Each catagory has a define that the compilation system will set
|
||||
* based on the environment the compile is initiated in. Programs
|
||||
* can test the define using the manifest constants defined here.
|
||||
* (e.g. #if (_MIPS_FPSET == 16) )
|
||||
*/
|
||||
|
||||
/*
|
||||
* Floating Point register set
|
||||
* Define:
|
||||
* _MIPS_FPSET
|
||||
* Can take on the values 16 or 32
|
||||
*/
|
||||
|
||||
/*
|
||||
* Instruction Set Architecture
|
||||
* Define:
|
||||
* _MIPS_ISA
|
||||
*/
|
||||
#define _MIPS_ISA_MIPS1 1 /* R2/3K */
|
||||
#define _MIPS_ISA_MIPS2 2 /* R4K/6K */
|
||||
#define _MIPS_ISA_MIPS3 3 /* R4K */
|
||||
#define _MIPS_ISA_MIPS4 4 /* TFP */
|
||||
|
||||
/*
|
||||
* Subprogram Interface Model
|
||||
* Define:
|
||||
* _MIPS_SIM
|
||||
*/
|
||||
#define _MIPS_SIM_ABI32 1 /* MIPS MSIG calling convention */
|
||||
#define _MIPS_SIM_NABI32 2 /* MIPS new 32-bit abi */
|
||||
/* NABI32 is 64bit calling convention but 32bit type sizes) */
|
||||
#define _MIPS_SIM_ABI64 3 /* MIPS 64 calling convention */
|
||||
|
||||
/*
|
||||
* Data Types Sizes (C and C++)
|
||||
* Defines:
|
||||
* _MIPS_SZINT
|
||||
* _MIPS_SZLONG
|
||||
* _MIPS_SZPTR
|
||||
*
|
||||
* These can take on the values: 32, 64, 128
|
||||
*/
|
||||
|
||||
/*
|
||||
* Compilation Environments
|
||||
* various compilers may offer a set of different compilation environments
|
||||
* each one will pre-define the above defines appropriately.
|
||||
* The MIPS ABI environment will pre-define the following:
|
||||
* (cc -systype=XXX)
|
||||
*
|
||||
* -D_MIPS_FPSET=16 -D_MIPS_ISA=_MIPS_ISA_MIPS1
|
||||
* -D_MIPS_SIM=_MIPS_SIM_ABI32 -D_MIPS_SZINT=32
|
||||
* -D_MIPS_SZLONG=32 -D_MIPS_SZPTR=32
|
||||
*
|
||||
* The new MIPS 32-bit ABI environment will pre-define the following
|
||||
* (cc -systype=XXX)
|
||||
* -D_MIPS_FPSET=32 -D_MIPS_ISA=_MIPS_ISA_MIPS3
|
||||
* -D_MIPS_SIM=_MIPS_SIM_NABI32 -D_MIPS_SZINT=32
|
||||
* -D_MIPS_SZLONG=32 -D_MIPS_SZPTR=32
|
||||
*
|
||||
* The MIPS 64 bit environment will pre-define the following
|
||||
* (cc -systype=XXX)
|
||||
* -D_MIPS_FPSET=32 -D_MIPS_ISA=_MIPS_ISA_MIPS3
|
||||
* -D_MIPS_SIM=_MIPS_SIM_ABI64 -D_MIPS_SZINT=32
|
||||
* -D_MIPS_SZLONG=64 -D_MIPS_SZPTR=64
|
||||
*
|
||||
*/
|
||||
|
||||
/*
|
||||
* Language Specific
|
||||
* Type __psint_t - a pointer sized int - this can be used:
|
||||
* a) when casting a pointer so can perform e.g. a bit operation
|
||||
* b) as a return code for functions incorrectly typed as int but
|
||||
* return a pointer.
|
||||
* User level code can also use the ANSI std ptrdiff_t, defined in stddef.h
|
||||
* in place of __psint_t
|
||||
* Type __scint_t - a 'scaling' int - used when in fact one wants an 'int'
|
||||
* that scales when moving to say 64 bit. (e.g. byte counts, bit lens)
|
||||
*/
|
||||
|
||||
#if (defined(_LANGUAGE_C) || defined(_LANGUAGE_C_PLUS_PLUS))
|
||||
|
||||
/*
|
||||
* assumes int is 32 -
|
||||
* otherwise there must be some other compiler basic type
|
||||
*/
|
||||
#if (_MIPS_SZINT != 32)
|
||||
#ifdef _MIPS_SZINT
|
||||
ERROR -- the macro "_MIPS_SZINT" is set to _MIPS_SZINT -- should be 32
|
||||
#else
|
||||
ERROR -- the macro "_MIPS_SZINT" is unset (currently, must be set to 32)
|
||||
#endif
|
||||
#endif
|
||||
|
||||
typedef int __int32_t;
|
||||
typedef unsigned __uint32_t;
|
||||
|
||||
#if (_MIPS_SZLONG == 64)
|
||||
|
||||
typedef long __int64_t;
|
||||
typedef unsigned long __uint64_t;
|
||||
|
||||
#else
|
||||
|
||||
#if defined(_LONGLONG)
|
||||
|
||||
typedef long long __int64_t;
|
||||
typedef unsigned long long __uint64_t;
|
||||
|
||||
#else
|
||||
|
||||
typedef struct {
|
||||
int hi32;
|
||||
int lo32;
|
||||
} __int64_t;
|
||||
typedef struct {
|
||||
unsigned int hi32;
|
||||
unsigned int lo32;
|
||||
} __uint64_t;
|
||||
|
||||
#endif /* _LONGLONG */
|
||||
|
||||
#endif /* _MIPS_SZLONG */
|
||||
|
||||
#if (_MIPS_SZPTR == 32)
|
||||
typedef __int32_t __psint_t;
|
||||
typedef __uint32_t __psunsigned_t;
|
||||
#endif
|
||||
|
||||
#if (_MIPS_SZPTR == 64)
|
||||
typedef __int64_t __psint_t;
|
||||
typedef __uint64_t __psunsigned_t;
|
||||
#endif
|
||||
|
||||
/*
|
||||
* If any fundamental type is 64 bit, then set the scaling type
|
||||
* to 64 bit
|
||||
*/
|
||||
#if (_MIPS_SZPTR == 64) || (_MIPS_SZLONG == 64) || (_MIPS_SZINT == 64)
|
||||
|
||||
/* there exists some large fundamental type */
|
||||
typedef __int64_t __scint_t;
|
||||
typedef __uint64_t __scunsigned_t;
|
||||
|
||||
#else
|
||||
|
||||
/* a 32 bit world */
|
||||
typedef __int32_t __scint_t;
|
||||
typedef __uint32_t __scunsigned_t;
|
||||
|
||||
#endif
|
||||
|
||||
#endif /* C || C++ */
|
||||
|
||||
#ifdef __cplusplus
|
||||
}
|
||||
#endif
|
||||
|
||||
#endif /* !__SGIDEFS_H__ */
|
||||
@@ -6,3 +6,80 @@
|
||||
typedef unsigned long size_t;
|
||||
|
||||
#endif
|
||||
|
||||
|
||||
#if 0
|
||||
/*
|
||||
*
|
||||
* Copyright 1992, Silicon Graphics, Inc.
|
||||
* All Rights Reserved.
|
||||
*
|
||||
* This is UNPUBLISHED PROPRIETARY SOURCE CODE of Silicon Graphics, Inc.;
|
||||
* the contents of this file may not be disclosed to third parties, copied or
|
||||
* duplicated in any form, in whole or in part, without the prior written
|
||||
* permission of Silicon Graphics, Inc.
|
||||
*
|
||||
* RESTRICTED RIGHTS LEGEND:
|
||||
* Use, duplication or disclosure by the Government is subject to restrictions
|
||||
* as set forth in subdivision (c)(1)(ii) of the Rights in Technical Data
|
||||
* and Computer Software clause at DFARS 252.227-7013, and/or in similar or
|
||||
* successor clauses in the FAR, DOD or NASA FAR Supplement. Unpublished -
|
||||
* rights reserved under the Copyright Laws of the United States.
|
||||
*/
|
||||
/* Copyright (c) 1990, 1991 UNIX System Laboratories, Inc. */
|
||||
/* Copyright (c) 1988 AT&T */
|
||||
/* All Rights Reserved */
|
||||
|
||||
/* THIS IS UNPUBLISHED PROPRIETARY SOURCE CODE OF */
|
||||
/* UNIX System Laboratories, Inc. */
|
||||
/* The copyright notice above does not evidence any */
|
||||
/* actual or intended publication of such source code. */
|
||||
#ifndef __STDDEF_H__
|
||||
#define __STDDEF_H__
|
||||
#ident "$Revision: 1.17 $"
|
||||
|
||||
#include <sgidefs.h>
|
||||
|
||||
#ifdef __cplusplus
|
||||
extern "C"
|
||||
{
|
||||
#endif
|
||||
|
||||
#if (_MIPS_SZPTR == 32)
|
||||
typedef int ptrdiff_t;
|
||||
#endif
|
||||
#if (_MIPS_SZPTR == 64)
|
||||
typedef __int64_t ptrdiff_t;
|
||||
#endif
|
||||
|
||||
#if !defined(_SIZE_T) && !defined(_SIZE_T_)
|
||||
# define _SIZE_T
|
||||
# if (_MIPS_SZLONG == 32)
|
||||
typedef unsigned int size_t;
|
||||
# endif
|
||||
# if (_MIPS_SZLONG == 64)
|
||||
typedef unsigned long size_t;
|
||||
# endif
|
||||
#endif
|
||||
|
||||
#ifndef NULL
|
||||
# define NULL 0
|
||||
#endif
|
||||
|
||||
#ifndef _WCHAR_T
|
||||
# define _WCHAR_T
|
||||
# if (_MIPS_SZLONG == 32)
|
||||
typedef long wchar_t;
|
||||
# endif
|
||||
# if (_MIPS_SZLONG == 64)
|
||||
typedef __int32_t wchar_t;
|
||||
# endif
|
||||
#endif
|
||||
|
||||
#define offsetof(s, m) (size_t)(&(((s *)0)->m))
|
||||
|
||||
#ifdef __cplusplus
|
||||
}
|
||||
#endif
|
||||
#endif /* !__STDDEF_H__ */
|
||||
#endif
|
||||
+224
-1
@@ -14,6 +14,229 @@ typedef struct ldiv_t
|
||||
} ldiv_t;
|
||||
|
||||
lldiv_t lldiv(long long, long long);
|
||||
ldiv_t ldiv(long, long);
|
||||
ldiv_t ldiv(long, long);
|
||||
|
||||
#endif
|
||||
|
||||
|
||||
#if 0
|
||||
#ifndef __STDLIB_H__
|
||||
#define __STDLIB_H__
|
||||
#ifdef __cplusplus
|
||||
extern "C" {
|
||||
#endif
|
||||
#ident "$Revision: 1.34 $"
|
||||
/*
|
||||
*
|
||||
* Copyright 1992, Silicon Graphics, Inc.
|
||||
* All Rights Reserved.
|
||||
*
|
||||
* This is UNPUBLISHED PROPRIETARY SOURCE CODE of Silicon Graphics, Inc.;
|
||||
* the contents of this file may not be disclosed to third parties, copied or
|
||||
* duplicated in any form, in whole or in part, without the prior written
|
||||
* permission of Silicon Graphics, Inc.
|
||||
*
|
||||
* RESTRICTED RIGHTS LEGEND:
|
||||
* Use, duplication or disclosure by the Government is subject to restrictions
|
||||
* as set forth in subdivision (c)(1)(ii) of the Rights in Technical Data
|
||||
* and Computer Software clause at DFARS 252.227-7013, and/or in similar or
|
||||
* successor clauses in the FAR, DOD or NASA FAR Supplement. Unpublished -
|
||||
* rights reserved under the Copyright Laws of the United States.
|
||||
*/
|
||||
/* Copyright (c) 1988 AT&T */
|
||||
/* All Rights Reserved */
|
||||
|
||||
/* THIS IS UNPUBLISHED PROPRIETARY SOURCE CODE OF AT&T */
|
||||
/* The copyright notice above does not evidence any */
|
||||
/* actual or intended publication of such source code. */
|
||||
|
||||
#include <sgidefs.h>
|
||||
|
||||
#ifndef NULL
|
||||
#define NULL 0
|
||||
#endif
|
||||
|
||||
/* Arguments to exit(2). */
|
||||
#define EXIT_FAILURE 1
|
||||
#define EXIT_SUCCESS 0
|
||||
|
||||
/* Maximum value returned by rand(3C). */
|
||||
#define RAND_MAX 32767
|
||||
|
||||
#ifdef _LANGUAGE_ASSEMBLY
|
||||
/* assembly-level offsets of quot, rem fields into [l ]div_t structure below */
|
||||
#define _QUOT_OFFSET 0
|
||||
#define _REM_OFFSET 4
|
||||
#if (_MIPS_SZLONG == 32)
|
||||
#define _LQUOT_OFFSET 0
|
||||
#define _LREM_OFFSET 4
|
||||
#endif
|
||||
#if (_MIPS_SZLONG == 64)
|
||||
#define _LQUOT_OFFSET 0
|
||||
#define _LREM_OFFSET 8
|
||||
#endif
|
||||
#if defined(_SGI_SOURCE) && defined(_LONGLONG) && !defined(_POSIX_SOURCE) && !defined(_XOPEN_SOURCE)
|
||||
#define _LLQUOT_OFFSET 0
|
||||
#define _LLREM_OFFSET 8
|
||||
#endif
|
||||
#endif
|
||||
|
||||
#if (defined(_LANGUAGE_C) || defined(_LANGUAGE_C_PLUS_PLUS))
|
||||
typedef struct {
|
||||
int quot;
|
||||
int rem;
|
||||
} div_t;
|
||||
|
||||
typedef struct {
|
||||
long quot;
|
||||
long rem;
|
||||
} ldiv_t;
|
||||
|
||||
#if defined(_SGI_SOURCE) && defined(_LONGLONG) && !defined(_POSIX_SOURCE) && !defined(_XOPEN_SOURCE)
|
||||
typedef struct {
|
||||
long long quot;
|
||||
long long rem;
|
||||
} lldiv_t;
|
||||
#endif
|
||||
|
||||
#if !defined(_SIZE_T) && !defined(_SIZE_T_)
|
||||
#define _SIZE_T
|
||||
#if (_MIPS_SZLONG == 32)
|
||||
typedef unsigned int size_t;
|
||||
#endif
|
||||
#if (_MIPS_SZLONG == 64)
|
||||
typedef unsigned long size_t;
|
||||
#endif
|
||||
#endif
|
||||
|
||||
#ifndef _SSIZE_T
|
||||
#define _SSIZE_T
|
||||
#if (_MIPS_SZLONG == 32)
|
||||
typedef int ssize_t;
|
||||
#endif
|
||||
#if (_MIPS_SZLONG == 64)
|
||||
typedef long ssize_t;
|
||||
#endif
|
||||
#endif
|
||||
|
||||
#ifndef _WCHAR_T
|
||||
#define _WCHAR_T
|
||||
#if (_MIPS_SZLONG == 32)
|
||||
typedef long wchar_t;
|
||||
#endif
|
||||
#if (_MIPS_SZLONG == 64)
|
||||
typedef __int32_t wchar_t;
|
||||
#endif
|
||||
#endif
|
||||
|
||||
extern unsigned char __ctype[];
|
||||
|
||||
#define MB_CUR_MAX (int)__ctype[520]
|
||||
|
||||
extern double atof(const char *);
|
||||
extern int atoi(const char *);
|
||||
extern long int atol(const char *);
|
||||
extern double strtod(const char *, char **);
|
||||
extern long int strtol(const char *, char **, int);
|
||||
extern unsigned long int strtoul(const char *, char **, int);
|
||||
#if defined(_SGI_SOURCE) && defined(_LONGLONG) && !defined(_POSIX_SOURCE) && !defined(_XOPEN_SOURCE)
|
||||
extern long long int atoll(const char *);
|
||||
extern long long int strtoll(const char *, char **, int);
|
||||
extern unsigned long long int strtoull(const char *, char **, int);
|
||||
#endif
|
||||
|
||||
extern int rand(void);
|
||||
extern void srand(unsigned int);
|
||||
|
||||
extern void *calloc(size_t, size_t);
|
||||
extern void free(void *);
|
||||
extern void *malloc(size_t);
|
||||
extern void *realloc(void *, size_t);
|
||||
|
||||
extern void abort(void);
|
||||
extern int atexit(void (*)(void));
|
||||
extern void exit(int);
|
||||
extern char *getenv(const char *);
|
||||
extern int system(const char *);
|
||||
|
||||
extern void *bsearch(const void *, const void *, size_t, size_t,
|
||||
int (*)(const void *, const void *));
|
||||
extern void qsort(void *, size_t, size_t,
|
||||
int (*)(const void *, const void *));
|
||||
|
||||
#ifdef __cplusplus
|
||||
#ifndef _ABS_
|
||||
#define _ABS_
|
||||
inline int abs(int x) {return x > 0 ? x : -x;}
|
||||
#endif
|
||||
#else
|
||||
extern int abs(int);
|
||||
#endif
|
||||
|
||||
extern div_t div(int, int);
|
||||
extern long int labs(long);
|
||||
extern ldiv_t ldiv(long, long);
|
||||
#if defined(_SGI_SOURCE) && defined(_LONGLONG) && !defined(_POSIX_SOURCE) && !defined(_XOPEN_SOURCE)
|
||||
extern long long llabs(long long);
|
||||
extern lldiv_t lldiv(long long, long long);
|
||||
#endif
|
||||
|
||||
extern int mbtowc(wchar_t *, const char *, size_t);
|
||||
extern int mblen(const char *, size_t);
|
||||
extern int wctomb(char *, wchar_t);
|
||||
|
||||
extern size_t mbstowcs(wchar_t *, const char *, size_t);
|
||||
extern size_t wcstombs(char *, const wchar_t *, size_t);
|
||||
|
||||
#if defined(_SVR4_SOURCE) && !defined(_POSIX_SOURCE) && !defined(_XOPEN_SOURCE)
|
||||
|
||||
extern long a64l(const char *);
|
||||
extern int dup2(int, int);
|
||||
extern char *ecvt(double, int, int *, int *);
|
||||
extern char *fcvt(double, int, int *, int *);
|
||||
extern char *getcwd(char *, size_t);
|
||||
extern char *getlogin(void);
|
||||
#include <getopt.h>
|
||||
extern char *getpass(const char *);
|
||||
extern int getpw(int, char *);
|
||||
extern char *gcvt(double, int, char *);
|
||||
extern int isatty(int);
|
||||
extern void l3tol(long *, const char *, int);
|
||||
extern char *l64a(long);
|
||||
extern void ltol3(char *, const long *, int);
|
||||
extern void * memalign(size_t, size_t);
|
||||
extern char *mktemp(char *);
|
||||
extern int putenv(char *);
|
||||
extern char *realpath(const char *, char *);
|
||||
extern void swab(const char *, char *, int);
|
||||
extern char *ttyname(int);
|
||||
extern int ttyslot(void);
|
||||
extern void *valloc(size_t);
|
||||
|
||||
extern double drand48(void);
|
||||
extern double erand48(unsigned short [3]);
|
||||
extern long lrand48(void);
|
||||
extern long nrand48(unsigned short [3]);
|
||||
extern long mrand48(void);
|
||||
extern long jrand48(unsigned short [3]);
|
||||
extern void srand48(long);
|
||||
extern unsigned short * seed48(const unsigned short [3]);
|
||||
extern void lcong48(const unsigned short [7]);
|
||||
|
||||
#endif /* _SVR4_SOURCE && !POSIX_SOURCE && !_XOPEN_SOURCE */
|
||||
#if (defined(_SGI_SOURCE) && !defined(_POSIX_SOURCE) && !defined(_XOPEN_SOURCE)) || defined(_SGI_REENTRANT_FUNCTIONS)
|
||||
|
||||
extern int rand_r(unsigned int *);
|
||||
extern char *ttyname_r(int, char *, int);
|
||||
extern char *ecvt_r(double, int, int *, int *, char *);
|
||||
extern char *fcvt_r(double, int, int *, int *, char *);
|
||||
#endif
|
||||
|
||||
#define mblen(s, n) mbtowc((wchar_t *)0, s, n)
|
||||
#endif /* _LANGUAGE_C || _LANGUAGE_C_PLUS_PLUS */
|
||||
|
||||
#ifdef __cplusplus
|
||||
}
|
||||
#endif
|
||||
#endif /* !__STDLIB_H__ */
|
||||
#endif
|
||||
+5
-4
@@ -1,8 +1,9 @@
|
||||
#ifndef _STRING_H_
|
||||
#define _STRING_H_
|
||||
#include "ultra64/types.h"
|
||||
void* memcpy(void*, const void*, size_t);
|
||||
size_t strlen(const u8 *str);
|
||||
const u8 *strchr(const u8 *str, u32 ch);
|
||||
#include <PR/ultratypes.h>
|
||||
|
||||
extern void *memcpy(void *, const void *, size_t);
|
||||
extern unsigned char *strchr(const unsigned char *, int);
|
||||
extern size_t strlen(const unsigned char *);
|
||||
|
||||
#endif
|
||||
@@ -0,0 +1,38 @@
|
||||
/* Copyright (C) 1989 Silicon Graphics, Inc. All rights reserved. */
|
||||
/*
|
||||
* |-----------------------------------------------------------|
|
||||
* | Copyright (c) 1991, 1990 MIPS Computer Systems, Inc. |
|
||||
* | All Rights Reserved |
|
||||
* |-----------------------------------------------------------|
|
||||
* | Restricted Rights Legend |
|
||||
* | Use, duplication, or disclosure by the Government is |
|
||||
* | subject to restrictions as set forth in |
|
||||
* | subparagraph (c)(1)(ii) of the Rights in Technical |
|
||||
* | Data and Computer Software Clause of DFARS 252.227-7013. |
|
||||
* | MIPS Computer Systems, Inc. |
|
||||
* | 950 DeGuigne Avenue |
|
||||
* | Sunnyvale, California 94088-3650, USA |
|
||||
* |-----------------------------------------------------------|
|
||||
*/
|
||||
|
||||
/* $Header: /proj/irix5.3/isms/cmplrs/commonlib/include/RCS/svr4_math.h,v 1.3 1993/06/08 01:20:14 bettina Exp $ */
|
||||
|
||||
#ifndef __SVR4_MATH_H__
|
||||
#define __SVR4_MATH_H__
|
||||
|
||||
#ifdef __cplusplus
|
||||
extern "C" {
|
||||
#endif
|
||||
|
||||
#define DOMAIN 1
|
||||
#define SING 2
|
||||
#define OVERFLOW 3
|
||||
#define UNDERFLOW 4
|
||||
#define TLOSS 5
|
||||
#define PLOSS 6
|
||||
|
||||
#ifdef __cplusplus
|
||||
}
|
||||
#endif
|
||||
|
||||
#endif /* __SVR4_MATH_H__ */
|
||||
+10
-18
@@ -8,26 +8,18 @@
|
||||
#endif
|
||||
|
||||
#include <PR/ultratypes.h>
|
||||
#include <PR/os_exception.h>
|
||||
#include <PR/os_misc.h>
|
||||
#include <PR/os_rdp.h>
|
||||
#include <PR/os_thread.h>
|
||||
#include <PR/os_time.h>
|
||||
#include <PR/os_message.h>
|
||||
#include <PR/os_cont.h>
|
||||
#include <PR/os_tlb.h>
|
||||
#include <PR/sptask.h>
|
||||
#include <PR/ucode.h>
|
||||
#include <PR/os_cache.h>
|
||||
#include <PR/os_vi.h>
|
||||
#include <PR/os_pi.h>
|
||||
#include <PR/os_internal.h>
|
||||
#include <PR/mbi.h>
|
||||
#include <PR/os_eeprom.h>
|
||||
#include <PR/os_libc.h>
|
||||
#include <PR/os.h>
|
||||
|
||||
#include <PR/gu.h>
|
||||
#include <PR/os_ai.h>
|
||||
#include <PR/mbi.h>
|
||||
#include <PR/libaudio.h>
|
||||
#include <PR/libultra.h>
|
||||
#include <PR/sptask.h>
|
||||
#include <PR/ucode.h>
|
||||
|
||||
#endif
|
||||
|
||||
//temporary catchall fix since not all files in master include bondgame
|
||||
#ifdef __INTELLISENSE__
|
||||
#define GLOBAL_ASM(...)
|
||||
#endif
|
||||
Reference in new issue
Block a user