Added missing extern "C"

This commit is contained in:
Xavi Del Campo 2020-02-01 00:51:53 +01:00
parent 5f638ea86c
commit 805fc37a06
7 changed files with 79 additions and 18 deletions

View File

@ -5,6 +5,11 @@
#ifndef _PSXBIOS_H #ifndef _PSXBIOS_H
#define _PSXBIOS_H #define _PSXBIOS_H
#ifdef __cplusplus
extern "C"
{
#endif
/* Joypad functions */ /* Joypad functions */
extern void PAD_init(unsigned long mode, unsigned long *pad_buf); extern void PAD_init(unsigned long mode, unsigned long *pad_buf);
@ -12,11 +17,11 @@ extern int PAD_dr(void);
/* ROM information functions */ /* ROM information functions */
/** /**
* Returns PSX kernel date. * Returns PSX kernel date.
* @return Kernel date n 0xYYYYMMDD BCD format. * @return Kernel date n 0xYYYYMMDD BCD format.
*/ */
unsigned long GetKernelDate(void); unsigned long GetKernelDate(void);
/** /**
@ -90,7 +95,7 @@ struct DIRENTRY
* Characters after * are ignored. * Characters after * are ignored.
* @param name File name string * @param name File name string
* @param dirent Pointer to a struct DIRENTRY object. * @param dirent Pointer to a struct DIRENTRY object.
* @return dirent on success, NULL on failure. * @return dirent on success, NULL on failure.
*/ */
struct DIRENTRY *firstfile(const char *name, struct DIRENTRY *dirent); struct DIRENTRY *firstfile(const char *name, struct DIRENTRY *dirent);
@ -106,7 +111,7 @@ struct DIRENTRY *firstfile(const char *name, struct DIRENTRY *dirent);
struct DIRENTRY *nextfile(struct DIRENTRY *dir); struct DIRENTRY *nextfile(struct DIRENTRY *dir);
/** /**
* Gets the file size of the file named "name". * Gets the file size of the file named "name".
* It is actually just a wrapper around firstfile. * It is actually just a wrapper around firstfile.
* It rounds the file size to the block size (2048). * It rounds the file size to the block size (2048).
@ -122,7 +127,7 @@ int get_file_size(const char *name);
* @param name File name string * @param name File name string
* @return File size in bytes, unrounded. * @return File size in bytes, unrounded.
*/ */
int get_real_file_size(const char *name); int get_real_file_size(const char *name);
void InitHeap(void *block , int size); void InitHeap(void *block , int size);
@ -182,7 +187,7 @@ int DisableEvent(unsigned int event);
int DeliverEvent(unsigned int ev1, // Cause descriptor int DeliverEvent(unsigned int ev1, // Cause descriptor
int ev2); // Event class int ev2); // Event class
/** /**
* Checks if the event specified by its identifier has occured * Checks if the event specified by its identifier has occured
* @param event Numerical event identifier * @param event Numerical event identifier
@ -203,13 +208,17 @@ int WaitEvent(unsigned int event);
* Replaces the executable image in memory with the one * Replaces the executable image in memory with the one
* contained in another executable file in PSX-EXE format. * contained in another executable file in PSX-EXE format.
* WARNING: Does not work right now. * WARNING: Does not work right now.
* *
* Most likely you want PSX_RunExe() * Most likely you want PSX_RunExe()
* @param name Path name of PSX-EXE executable * @param name Path name of PSX-EXE executable
* @param argc Number of arguments * @param argc Number of arguments
* @param argv Pointer to an array of string pointers for each argument * @param argv Pointer to an array of string pointers for each argument
*/ */
void LoadExec(char *name, int argc, char **argv); void LoadExec(char *name, int argc, char **argv);
#ifdef __cplusplus
}
#endif
#endif #endif

View File

@ -1,6 +1,13 @@
#ifndef _PSXGPU_H #ifndef _PSXGPU_H
#define _PSXGPU_H #define _PSXGPU_H
#ifdef __cplusplus
extern "C"
{
#endif
#include <stdarg.h>
#define GPU_DATA_PORT_ADDR 0x1f801810 #define GPU_DATA_PORT_ADDR 0x1f801810
#define GPU_CONTROL_PORT_ADDR 0x1f801814 #define GPU_CONTROL_PORT_ADDR 0x1f801814
#define GPU_DATA_PORT *((volatile unsigned int*)GPU_DATA_PORT_ADDR) #define GPU_DATA_PORT *((volatile unsigned int*)GPU_DATA_PORT_ADDR)
@ -13,8 +20,6 @@
#define get_clutid(cx, cy) (((cx&0x3ff)>>4)|((cy&0x1ff)<<6)) #define get_clutid(cx, cy) (((cx&0x3ff)>>4)|((cy&0x1ff)<<6))
#include <stdarg.h>
/** /**
* Initializes the GPU. Same as GsInitEx(0) * Initializes the GPU. Same as GsInitEx(0)
* *
@ -1139,6 +1144,10 @@ void GsSortPolyLine(GsPolyLine *line);
void GsSortGPolyLine(GsGPolyLine *line); void GsSortGPolyLine(GsGPolyLine *line);
#ifdef __cplusplus
}
#endif
//void GsSortSimpleMap(GsMap *map); //void GsSortSimpleMap(GsMap *map);
#endif #endif

View File

@ -1,6 +1,11 @@
#ifndef _SPU_H #ifndef _SPU_H
#define _SPU_H #define _SPU_H
#ifdef __cplusplus
extern "C"
{
#endif
#define SPU_ADDR *((volatile unsigned short*)0x1f801da6) #define SPU_ADDR *((volatile unsigned short*)0x1f801da6)
#define SPU_DATA *((volatile unsigned short*)0x1f801da8) #define SPU_DATA *((volatile unsigned short*)0x1f801da8)
#define SPU_CONTROL *((volatile unsigned short*)0x1f801daa) #define SPU_CONTROL *((volatile unsigned short*)0x1f801daa)
@ -222,4 +227,8 @@ void SsEnableExt(void);
void SsCdVol(unsigned short left, unsigned short right); void SsCdVol(unsigned short left, unsigned short right);
#ifdef __cplusplus
}
#endif
#endif #endif

View File

@ -8,7 +8,7 @@
#ifdef _PSXSDK_WRAPPER #ifdef _PSXSDK_WRAPPER
/* /*
* Dirty hack... * Dirty hack...
*/ */
#include "/usr/include/stdio.h" #include "/usr/include/stdio.h"
@ -20,6 +20,11 @@
#include <stdarg.h> #include <stdarg.h>
#include <stdbool.h> #include <stdbool.h>
#ifdef __cplusplus
extern "C"
{
#endif
#define SEEK_SET 0 #define SEEK_SET 0
#define SEEK_CUR 1 #define SEEK_CUR 1
#define SEEK_END 2 #define SEEK_END 2
@ -58,7 +63,7 @@ typedef struct
/** Current file position */ /** Current file position */
unsigned int pos; unsigned int pos;
/** File access mode */ /** File access mode */
unsigned int mode; unsigned int mode;
/** Device ID */ /** Device ID */
unsigned int dev; unsigned int dev;
/** Size in bytes */ /** Size in bytes */
@ -134,7 +139,7 @@ int remove(const char *filename);
/** /**
* Redirects STDIO to SIO (serial port) * Redirects STDIO to SIO (serial port)
*/ */
void redirect_stdio_to_sio(void); void redirect_stdio_to_sio(void);
/** /**
@ -144,21 +149,21 @@ void redirect_stdio_to_sio(void);
* *
* @param setting New status of the setting (0 = disabled, 1 = enabled) * @param setting New status of the setting (0 = disabled, 1 = enabled)
*/ */
void sio_stdio_mapcr(unsigned int setting); void sio_stdio_mapcr(unsigned int setting);
/** /**
* scanf and friends * scanf and friends
*/ */
int vsscanf(const char *str, const char *fmt, va_list ap); int vsscanf(const char *str, const char *fmt, va_list ap);
int sscanf(const char *str, const char *fmt, ...); int sscanf(const char *str, const char *fmt, ...);
/** /**
* STDIO for SIO * STDIO for SIO
*/ */
int sio_putchar(int c); int sio_putchar(int c);
int sio_puts(const char *str); int sio_puts(const char *str);
int sio_printf(const char *fmt, ...); int sio_printf(const char *fmt, ...);
@ -166,5 +171,8 @@ int sio_vprintf(const char *fmt, va_list ap);
#endif #endif
#ifdef __cplusplus
}
#endif #endif
#endif

View File

@ -9,6 +9,11 @@
#ifndef _STDLIB_H #ifndef _STDLIB_H
#define _STDLIB_H #define _STDLIB_H
#ifdef __cplusplus
extern "C"
{
#endif
typedef unsigned int size_t; typedef unsigned int size_t;
typedef signed int ssize_t; typedef signed int ssize_t;
@ -62,5 +67,9 @@ void call_atexit_callbacks(void);
#define EXIT_SUCCESS 0 #define EXIT_SUCCESS 0
#define EXIT_FAILURE 1 #define EXIT_FAILURE 1
#ifdef __cplusplus
}
#endif
#endif #endif

View File

@ -12,6 +12,11 @@
#ifndef _STRING_H #ifndef _STRING_H
#define _STRING_H #define _STRING_H
#ifdef __cplusplus
extern "C"
{
#endif
#include <strings.h> // for backwards compatibility #include <strings.h> // for backwards compatibility
#include <types.h> #include <types.h>
@ -60,5 +65,8 @@ void *memmem(const void *big, size_t big_len, const void *little, size_t little_
int ffsl(long value); int ffsl(long value);
int ffsll(long long value); int ffsll(long long value);
#ifdef __cplusplus
}
#endif #endif
#endif

View File

@ -1,4 +1,4 @@
/* /*
* strings.h * strings.h
* *
* PSXSDK * PSXSDK
@ -7,6 +7,11 @@
#ifndef _STRINGS_H #ifndef _STRINGS_H
#define _STRINGS_H #define _STRINGS_H
#ifdef __cplusplus
extern "C"
{
#endif
#include <string.h> #include <string.h>
#include <types.h> #include <types.h>
@ -34,4 +39,8 @@ unsigned int popcount64(uint64_t value);
int strcasecmp(const char *s1, const char *s2); int strcasecmp(const char *s1, const char *s2);
int strncasecmp(const char *s1, const char *s2, size_t len); int strncasecmp(const char *s1, const char *s2, size_t len);
#ifdef __cplusplus
}
#endif
#endif #endif