aboutsummaryrefslogtreecommitdiff
path: root/libpsn00b/include
diff options
context:
space:
mode:
authorJohn Wilbert M. Villamor <lameguy64@gmail.com>2019-07-17 11:30:07 +0800
committerJohn Wilbert M. Villamor <lameguy64@gmail.com>2019-07-17 11:30:07 +0800
commit0d4345a9bf2623df079c50a3bc73cbb7deca1176 (patch)
tree6cda70b844f39fc2d65a806b91a6010066433b56 /libpsn00b/include
parentb956c5391b955e793a4d54572aa58872b4c66c30 (diff)
downloadpsn00bsdk-0d4345a9bf2623df079c50a3bc73cbb7deca1176.tar.gz
Added C++ support, updated build instructions and makefiles, consolidated libc and libgcc (during build process), libraries now v0.12b and more
Diffstat (limited to 'libpsn00b/include')
-rw-r--r--libpsn00b/include/assert.h6
-rw-r--r--libpsn00b/include/ioctl.h19
-rw-r--r--libpsn00b/include/psxapi.h2
-rw-r--r--libpsn00b/include/psxgpu.h20
-rw-r--r--libpsn00b/include/psxgte.h8
-rw-r--r--libpsn00b/include/stdarg.h122
-rw-r--r--libpsn00b/include/stdio.h8
-rw-r--r--libpsn00b/include/sys/types.h2
8 files changed, 50 insertions, 137 deletions
diff --git a/libpsn00b/include/assert.h b/libpsn00b/include/assert.h
new file mode 100644
index 0000000..3114b57
--- /dev/null
+++ b/libpsn00b/include/assert.h
@@ -0,0 +1,6 @@
+#ifndef _ASSERT_H
+#define _ASSERT_H
+
+void assert(int e);
+
+#endif \ No newline at end of file
diff --git a/libpsn00b/include/ioctl.h b/libpsn00b/include/ioctl.h
new file mode 100644
index 0000000..5c56422
--- /dev/null
+++ b/libpsn00b/include/ioctl.h
@@ -0,0 +1,19 @@
+#ifndef _IOCTL_H
+#define _IOCTL_H
+
+#ifndef NULL
+#define NULL 0
+#endif
+
+#ifndef EOF
+#define EOF -1
+#endif
+
+// General
+#define FIONBLOCK (('f'<<8)|1)
+#define FIOCSCAN (('f'<<8)|2)
+
+// disk
+#define DIO_FORMAT (('d'<<8)|1)
+
+#endif \ No newline at end of file
diff --git a/libpsn00b/include/psxapi.h b/libpsn00b/include/psxapi.h
index 68dac67..f5a3c07 100644
--- a/libpsn00b/include/psxapi.h
+++ b/libpsn00b/include/psxapi.h
@@ -79,7 +79,7 @@ void SysDeqIntRP(int pri, INT_RP *rp);
// Event handler stuff
-int OpenEvent(unsigned int class, int spec, int mode, void (*func)());
+int OpenEvent(unsigned int cl, int spec, int mode, void (*func)());
int CloseEvent(int ev_desc);
int EnableEvent(int ev_desc);
int DisableEvent(int ev_desc);
diff --git a/libpsn00b/include/psxgpu.h b/libpsn00b/include/psxgpu.h
index 40b9159..2415c83 100644
--- a/libpsn00b/include/psxgpu.h
+++ b/libpsn00b/include/psxgpu.h
@@ -25,15 +25,11 @@
#define setVector( v, _x, _y, _z ) \
(v)->vx = _x, (v)->vy = _y, (v)->vz = _z
-#define setRECT( r, _x, _y, _w, _h ) \
+#define setRECT( v, _x, _y, _w, _h ) \
(v)->x = _x, (v)->y = _y, (v)->w = _w, (v)->h = _h
-
-
-
-// Primitive macros
-
+// Primitive macros
#define setDrawTPage( p, tp, abr, x, y ) \
( (p)->code[0] = getTPage( tp, abr, x, y ), \
@@ -96,7 +92,6 @@
#define setWH( p, _w, _h ) \
(p)->w = _w, (p)->h = _h
-
/*
* Set texture coordinates
*/
@@ -183,11 +178,16 @@
#define setTile16( p ) setlen( p, 2 ), setcode( p, 0x78 )
#define setTile( p ) setlen( p, 3 ), setcode( p, 0x60 )
+#define setLineF2( p ) setlen( p, 3 ), setcode( p, 0x40 )
#define setLineG2( p ) setlen( p, 4 ), setcode( p, 0x50 )
+#define setLineF3( p ) setlen( p, 5 ), setcode( p, 0x48 ), (p)->pad = 0x55555555
+#define setLineG3( p ) setlen( p, 7 ), setcode( p, 0x58 ), (p)->pad = 0x55555555, \
+ (p)->p1 = 0, (p)->p2 = 0
+
#define setLineF4( p ) setlen( p, 6 ), setcode( p, 0x4c ), (p)->pad = 0x55555555
#define setLineG4( p ) setlen( p, 9 ), setcode( p, 0x5c ), (p)->pad = 0x55555555, \
- (p)->p2 = 0, (p)->p3 = 0
+ (p)->p1 = 0, (p)->p2 = 0, (p)->p3 = 0
#define setFill( p ) setlen( p, 3 ), setcode( p, 0x02 )
@@ -533,14 +533,18 @@ int DrawSync(int m);
void WaitGPUcmd();
void WaitGPUdma();
+// Callback hook functions
void *VSyncCallback(void (*func)());
void *DrawSyncCallback(void (*func)());
+// Interrupt callback functions
void *DMACallback(int dma, void (*func)());
void *InterruptCallback(int irq, void (*func)());
void *GetInterruptCallback(int irq); // Original
+void RestartCallback();
void LoadImage(RECT *rect, unsigned int *data);
+void StoreImage(RECT *rect, unsigned int *data);
void ClearOTagR(unsigned int* ot, int n);
void DrawOTag(unsigned int* ot);
diff --git a/libpsn00b/include/psxgte.h b/libpsn00b/include/psxgte.h
index 0a8ded0..43d529a 100644
--- a/libpsn00b/include/psxgte.h
+++ b/libpsn00b/include/psxgte.h
@@ -29,6 +29,10 @@ typedef struct {
unsigned char r, g, b, cd;
} CVECTOR;
+typedef struct {
+ short vx, vy;
+} DVECTOR;
+
#ifdef __cplusplus
extern "C" {
@@ -46,8 +50,8 @@ int icos(int a);
int hisin(int a);
int hicos(int a);
-void PushMatrix();
-void PopMatrix();
+void PushMatrix(void);
+void PopMatrix(void);
MATRIX *RotMatrix(SVECTOR *r, MATRIX *m);
MATRIX *HiRotMatrix(VECTOR *r, MATRIX *m);
diff --git a/libpsn00b/include/stdarg.h b/libpsn00b/include/stdarg.h
deleted file mode 100644
index bdf4c00..0000000
--- a/libpsn00b/include/stdarg.h
+++ /dev/null
@@ -1,122 +0,0 @@
-/* Copyright (C) 1989-2018 Free Software Foundation, Inc.
-This file is part of GCC.
-GCC is free software; you can redistribute it and/or modify
-it under the terms of the GNU General Public License as published by
-the Free Software Foundation; either version 3, or (at your option)
-any later version.
-GCC is distributed in the hope that it will be useful,
-but WITHOUT ANY WARRANTY; without even the implied warranty of
-MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
-GNU General Public License for more details.
-Under Section 7 of GPL version 3, you are granted additional
-permissions described in the GCC Runtime Library Exception, version
-3.1, as published by the Free Software Foundation.
-You should have received a copy of the GNU General Public License and
-a copy of the GCC Runtime Library Exception along with this program;
-see the files COPYING3 and COPYING.RUNTIME respectively. If not, see
-<http://www.gnu.org/licenses/>. */
-
-/*
- * ISO C Standard: 7.15 Variable arguments <stdarg.h>
- */
-
-#ifndef _STDARG_H
-#ifndef _ANSI_STDARG_H_
-#ifndef __need___va_list
-#define _STDARG_H
-#define _ANSI_STDARG_H_
-#endif /* not __need___va_list */
-#undef __need___va_list
-
-/* Define __gnuc_va_list. */
-
-#ifndef __GNUC_VA_LIST
-#define __GNUC_VA_LIST
-typedef __builtin_va_list __gnuc_va_list;
-#endif
-
-/* Define the standard macros for the user,
- if this invocation was from the user program. */
-#ifdef _STDARG_H
-
-#define va_start(v,l) __builtin_va_start(v,l)
-#define va_end(v) __builtin_va_end(v)
-#define va_arg(v,l) __builtin_va_arg(v,l)
-#if !defined(__STRICT_ANSI__) || __STDC_VERSION__ + 0 >= 199900L \
- || __cplusplus + 0 >= 201103L
-#define va_copy(d,s) __builtin_va_copy(d,s)
-#endif
-#define __va_copy(d,s) __builtin_va_copy(d,s)
-
-/* Define va_list, if desired, from __gnuc_va_list. */
-/* We deliberately do not define va_list when called from
- stdio.h, because ANSI C says that stdio.h is not supposed to define
- va_list. stdio.h needs to have access to that data type,
- but must not use that name. It should use the name __gnuc_va_list,
- which is safe because it is reserved for the implementation. */
-
-#ifdef _BSD_VA_LIST
-#undef _BSD_VA_LIST
-#endif
-
-#if defined(__svr4__) || (defined(_SCO_DS) && !defined(__VA_LIST))
-/* SVR4.2 uses _VA_LIST for an internal alias for va_list,
- so we must avoid testing it and setting it here.
- SVR4 uses _VA_LIST as a flag in stdarg.h, but we should
- have no conflict with that. */
-#ifndef _VA_LIST_
-#define _VA_LIST_
-#ifdef __i860__
-#ifndef _VA_LIST
-#define _VA_LIST va_list
-#endif
-#endif /* __i860__ */
-typedef __gnuc_va_list va_list;
-#ifdef _SCO_DS
-#define __VA_LIST
-#endif
-#endif /* _VA_LIST_ */
-#else /* not __svr4__ || _SCO_DS */
-
-/* The macro _VA_LIST_ is the same thing used by this file in Ultrix.
- But on BSD NET2 we must not test or define or undef it.
- (Note that the comments in NET 2's ansi.h
- are incorrect for _VA_LIST_--see stdio.h!) */
-#if !defined (_VA_LIST_) || defined (__BSD_NET2__) || defined (____386BSD____) || defined (__bsdi__) || defined (__sequent__) || defined (__FreeBSD__) || defined(WINNT)
-/* The macro _VA_LIST_DEFINED is used in Windows NT 3.5 */
-#ifndef _VA_LIST_DEFINED
-/* The macro _VA_LIST is used in SCO Unix 3.2. */
-#ifndef _VA_LIST
-/* The macro _VA_LIST_T_H is used in the Bull dpx2 */
-#ifndef _VA_LIST_T_H
-/* The macro __va_list__ is used by BeOS. */
-#ifndef __va_list__
-typedef __gnuc_va_list va_list;
-#endif /* not __va_list__ */
-#endif /* not _VA_LIST_T_H */
-#endif /* not _VA_LIST */
-#endif /* not _VA_LIST_DEFINED */
-#if !(defined (__BSD_NET2__) || defined (____386BSD____) || defined (__bsdi__) || defined (__sequent__) || defined (__FreeBSD__))
-#define _VA_LIST_
-#endif
-#ifndef _VA_LIST
-#define _VA_LIST
-#endif
-#ifndef _VA_LIST_DEFINED
-#define _VA_LIST_DEFINED
-#endif
-#ifndef _VA_LIST_T_H
-#define _VA_LIST_T_H
-#endif
-#ifndef __va_list__
-#define __va_list__
-#endif
-
-#endif /* not _VA_LIST_, except on certain systems */
-
-#endif /* not __svr4__ */
-
-#endif /* _STDARG_H */
-
-#endif /* not _ANSI_STDARG_H_ */
-#endif /* not _STDARG_H */ \ No newline at end of file
diff --git a/libpsn00b/include/stdio.h b/libpsn00b/include/stdio.h
index 98c69d0..81249de 100644
--- a/libpsn00b/include/stdio.h
+++ b/libpsn00b/include/stdio.h
@@ -43,10 +43,10 @@ extern int getchar(void);
extern void putchar(int __c);
// The following functions do not use the BIOS
-int vsnprintf(char *string, unsigned int size, char *fmt, va_list ap);
-int vsprintf(char *string, char *fmt, va_list ap);
-int sprintf(char *string, char *fmt, ...);
-int snprintf(char *string, unsigned int size, char *fmt, ...);
+int vsnprintf(char *string, unsigned int size, const char *fmt, va_list ap);
+int vsprintf(char *string, const char *fmt, va_list ap);
+int sprintf(char *string, const char *fmt, ...);
+int snprintf(char *string, unsigned int size, const char *fmt, ...);
#ifdef __cplusplus
}
diff --git a/libpsn00b/include/sys/types.h b/libpsn00b/include/sys/types.h
index 2f30a5f..c412700 100644
--- a/libpsn00b/include/sys/types.h
+++ b/libpsn00b/include/sys/types.h
@@ -6,4 +6,6 @@ typedef unsigned short u_short;
typedef unsigned int u_int;
typedef unsigned long u_long;
+typedef unsigned int size_t;
+
#endif // _TYPES_H \ No newline at end of file