Initial aurora setup, doesn't build yet

This commit is contained in:
dbalatoni13 2025-04-02 04:17:26 +02:00
parent ba0d7ef58c
commit 2509e01125
18 changed files with 430 additions and 9 deletions

View file

@ -1,58 +0,0 @@
#ifndef _CTYPE_H
#define _CTYPE_H
#include "dolphin/types.h"
extern unsigned char __ctype_map[256];
extern unsigned char __lower_map[256];
extern unsigned char __upper_map[256];
#define __control_char 0x01
#define __motion_char 0x02
#define __space_char 0x04
#define __punctuation 0x08
#define __digit 0x10
#define __hex_digit 0x20
#define __lower_case 0x40
#define __upper_case 0x80
#define __letter (__lower_case | __upper_case)
#define __alphanumeric (__letter | __digit)
#define __graphic (__alphanumeric | __punctuation)
#define __printable (__graphic | __space_char)
#define __whitespace (__motion_char | __space_char)
#define __control (__motion_char | __control_char)
#ifdef __MWERKS__
#define DECL_WEAK __declspec(weak)
#else
#define DECL_WEAK __attribute__((weak))
#endif
#ifdef __cplusplus
extern "C"
{
#endif
DECL_WEAK int isalpha(int __c);
DECL_WEAK int isdigit(int __c);
DECL_WEAK int isspace(int __c);
DECL_WEAK int isupper(int __c);
DECL_WEAK int isxdigit(int __c);
DECL_WEAK int tolower(int __c);
DECL_WEAK int toupper(int __c);
// added underscore to avoid naming conflicts
inline int _isalpha(int c) { return (int)(__ctype_map[(u8)c] & __letter); }
inline int _isdigit(int c) { return (int)(__ctype_map[(u8)c] & __digit); }
inline int _isspace(int c) { return (int)(__ctype_map[(u8)c] & __whitespace); }
inline int _isupper(int c) { return (int)(__ctype_map[(u8)c] & __upper_case); }
inline int _isxdigit(int c) { return (int)(__ctype_map[(u8)c] & __hex_digit); }
inline int _tolower(int c) { return (c == -1 ? -1 : (int)__lower_map[(u8)c]); }
inline int _toupper(int c) { return (c == -1 ? -1 : (int)__upper_map[(u8)c]); }
#ifdef __cplusplus
}
#endif
#endif

View file

@ -1,18 +0,0 @@
#ifndef _FLOAT_H_
#define _FLOAT_H_
#ifdef __cplusplus
extern "C" {
#endif
#define FLT_MAX 3.402823466e+38f
#define FLT_EPSILON 1.192092896e-07f
#define FLT_MIN 1.175494351e-38f
#define DBL_EPSILON 1.1920929e-07
#ifdef __cplusplus
}
#endif
#endif

View file

@ -1,127 +0,0 @@
#ifndef _MATH_H
#define _MATH_H
#define M_PI 3.141592653589793
#ifndef _MATH_INLINE
#define _MATH_INLINE static inline
#endif
extern int __float_nan[];
extern int __float_huge[];
extern int __double_huge[];
#define INFINITY (*(float *)__float_huge)
#define NAN (*(float *)__float_nan)
#define HUGE_VAL (*(double *)__double_huge)
#ifdef __MWERKS__
extern inline double sqrt(double x)
{
if (x > 0.0) {
double guess = __frsqrte(x); /* returns an approximation to */
guess = .5 * guess * (3.0 - guess * guess * x); /* now have 8 sig bits */
guess = .5 * guess * (3.0 - guess * guess * x); /* now have 16 sig bits */
guess = .5 * guess * (3.0 - guess * guess * x); /* now have 32 sig bits */
guess = .5 * guess * (3.0 - guess * guess * x); /* now have > 53 sig bits */
return x * guess;
}
else if (x == 0)
return 0;
else if (x)
return NAN;
return INFINITY;
}
extern inline float sqrtf(float x)
{
static const double _half = .5;
static const double _three = 3.0;
volatile float y;
if (x > 0.0f) {
double guess = __frsqrte((double)x); // returns an approximation to
guess = _half * guess * (_three - guess * guess * x); // now have 12 sig bits
guess = _half * guess * (_three - guess * guess * x); // now have 24 sig bits
guess = _half * guess * (_three - guess * guess * x); // now have 32 sig bits
y = (float)(x * guess);
return y;
}
return x;
}
#else
double sqrt(double x);
float sqrtf(float x);
#endif
double atan(double x);
double copysign(double x, double y);
double cos(double x);
double floor(double x);
double frexp(double x, int *exp);
double ldexp(double x, int exp);
double modf(double x, double *intpart);
double sin(double x);
double tan(double x);
double acos(double x);
double asin(double x);
double atan2(double y, double x);
double fmod(double x, double y);
double log(double x);
double pow(double x, double y);
float tanf(float x);
#ifdef __MWERKS__
extern inline double fabs(double x)
{
return __fabs(x);
}
#else
double fabs(double x);
#endif
_MATH_INLINE float fabsf(float x)
{
return (float)fabs((double)x);
}
_MATH_INLINE float sinf(float x)
{
return (float)sin((double)x);
}
_MATH_INLINE float cosf(float x)
{
return (float)cos((double)x);
}
_MATH_INLINE float atan2f(float y, float x)
{
return (float)atan2((double)y, (double)x);
}
_MATH_INLINE float atanf(float x)
{
return (float)atan((double)x);
}
_MATH_INLINE float asinf(float x)
{
return (float)asin((double)x);
}
_MATH_INLINE float acosf(float x)
{
return (float)acos((double)x);
}
_MATH_INLINE float fmodf(float x, float m)
{
return (float)fmod((double)x, (double)m);
}
_MATH_INLINE float floorf(float x)
{
return floor(x);
}
_MATH_INLINE float powf(float __x, float __y)
{
return pow(__x, __y);
}
#endif

18
include/port/imgui.h Normal file
View file

@ -0,0 +1,18 @@
#ifndef _SRC_IMGUI_H_
#define _SRC_IMGUI_H_
#include <aurora/aurora.h>
#ifdef __cplusplus
extern "C"
{
#endif
void imgui_main(const AuroraInfo* info);
void frame_limiter();
#ifdef __cplusplus
}
#endif
#endif

View file

@ -1,39 +0,0 @@
#ifndef _MSL_COMMON_STDARG_H
#define _MSL_COMMON_STDARG_H
#ifdef __cplusplus
extern "C" {
#endif
#ifdef __MWERKS__
typedef struct {
char gpr;
char fpr;
char reserved[2];
char* input_arg_area;
char* reg_save_area;
} __va_list[1];
typedef __va_list va_list;
#ifndef __MWERKS__
extern void __builtin_va_info(va_list*);
#endif
void* __va_arg(va_list v_list, unsigned char type);
#define va_start(ap, fmt) ((void)fmt, __builtin_va_info(&ap))
#define va_arg(ap, t) (*((t*)__va_arg(ap, _var_arg_typeof(t))))
#define va_end(ap) (void)0
#else
typedef __builtin_va_list va_list;
#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)
#endif
#ifdef __cplusplus
}
#endif
#endif /* _MSL_COMMON_STDARG_H */

View file

@ -1,28 +0,0 @@
#ifndef _STDDEF_H_
#define _STDDEF_H_
#ifdef __cplusplus
extern "C" {
#endif
#define offsetof(type, member) ((size_t) & (((type*)0)->member))
/* These break 1.2.5 */
//typedef __typeof__(sizeof(0)) size_t;
//typedef __typeof__((char*)0 - (char*)0) ptrdiff_t;
#ifdef __INTELLISENSE__
typedef unsigned int size_t;
typedef int ptrdiff_t;
#else
typedef unsigned long size_t;
typedef long ptrdiff_t;
#endif
#ifndef NULL
#define NULL 0L
#endif
#ifdef __cplusplus
}
#endif
#endif

View file

@ -1,14 +0,0 @@
#ifndef _STDINT_H_
#define _STDINT_H_
#ifdef __cplusplus
extern "C" {
#endif
typedef unsigned long int uintptr_t;
#ifdef __cplusplus
}
#endif
#endif

View file

@ -1,12 +0,0 @@
#ifndef _STDIO_H_
#define _STDIO_H_
#include "stdarg.h"
int puts(const char* s);
int printf(const char*, ...);
int sprintf(char* s, const char* format, ...);
int vprintf(const char* format, va_list arg);
int vsprintf(char* s, const char* format, va_list arg);
#endif

View file

@ -1,10 +0,0 @@
#ifndef _STDLIB_H
#define _STDLIB_H
#ifdef __MWERKS__
#define abs(x) __abs(x)
#else
int abs(int x);
#endif
#endif

View file

@ -1,18 +0,0 @@
#ifndef _STRING_H_
#define _STRING_H_
typedef unsigned long size_t;
void* memcpy(void* dst, const void* src, size_t n);
void* memset(void* dst, int val, size_t n);
char* strrchr(const char* str, int c);
char* strchr(const char* str, int c);
int strncmp(const char* str1, const char* str2, size_t n);
int strcmp(const char* str1, const char* str2);
char* strcat(char* dst, const char* src, size_t n);
char* strncpy(char* dst, const char* src, size_t n);
char* strcpy(char* dst, const char* src);
size_t strlen(const char* str);
#endif