Reformat to something more readable for me :3
Build libsm64 / Build libsm64 for linux (push) Failing after 29s
Build libsm64 / Build libsm64 for web (push) Failing after 31s
Build libsm64 / Build libsm64 for windows (push) Failing after 23s

This commit is contained in:
2026-05-24 11:31:35 -05:00
parent 4328104536
commit da3d3b9727
141 changed files with 29855 additions and 20635 deletions
+9 -9
View File
@@ -16,9 +16,9 @@ pthread_t gSoundThread;
long long timeInMilliseconds(void)
{
struct timeval tv;
gettimeofday(&tv, NULL);
gettimeofday(&tv, nullptr);
return(((long long)tv.tv_sec)*1000)+(tv.tv_usec/1000);
return(long long)tv.tv_sec*1000+tv.tv_usec/1000;
}
void* audio_thread(void* keepAlive)
@@ -26,14 +26,14 @@ void* audio_thread(void* keepAlive)
// from https://github.com/ckosmic/libsm64/blob/audio/src/libsm64.c#L535-L555
// except keepAlive is a null pointer here, so don't use it
pthread_setcancelstate(PTHREAD_CANCEL_ENABLE,NULL);
pthread_setcanceltype(PTHREAD_CANCEL_DEFERRED,NULL);
pthread_setcancelstate(PTHREAD_CANCEL_ENABLE,nullptr);
pthread_setcanceltype(PTHREAD_CANCEL_DEFERRED,nullptr);
long long currentTime = timeInMilliseconds();
long long targetTime = 0;
while(1)
{
//if(!*((bool*)keepAlive)) return NULL;
//if(!*((bool*)keepAlive)) return nullptr;
int16_t audioBuffer[544 * 2 * 2];
uint32_t numSamples = sm64_audio_tick(SDL_GetQueuedAudioSize(dev)/4, 1100, audioBuffer);
@@ -44,7 +44,7 @@ void* audio_thread(void* keepAlive)
while (timeInMilliseconds() < targetTime)
{
usleep(100);
//if(!*((bool*)keepAlive)) return NULL;
//if(!*((bool*)keepAlive)) return nullptr;
}
currentTime = timeInMilliseconds();
}
@@ -63,8 +63,8 @@ void audio_init()
want.format = AUDIO_S16;
want.channels = 2;
want.samples = 512;
want.callback = NULL;
dev = SDL_OpenAudioDevice(NULL, 0, &want, &have, 0);
want.callback = nullptr;
dev = SDL_OpenAudioDevice(nullptr, 0, &want, &have, 0);
if (dev == 0) {
fprintf(stderr, "SDL_OpenAudio error: %s\n", SDL_GetError());
return;
@@ -72,6 +72,6 @@ void audio_init()
SDL_PauseAudioDevice(dev, 0);
// it's best to run audio in a separate thread
pthread_create(&gSoundThread, NULL, audio_thread, NULL);
pthread_create(&gSoundThread, nullptr, audio_thread, nullptr);
}
+3 -3
View File
@@ -12,7 +12,7 @@ void context_init( const char *title, int width, int height, int major, int mino
{
if( SDL_Init( SDL_INIT_VIDEO | SDL_INIT_JOYSTICK ) < 0 ) goto err;
int profile = (major < 3) ? SDL_GL_CONTEXT_PROFILE_COMPATIBILITY : SDL_GL_CONTEXT_PROFILE_CORE;
int profile = major < 3 ? SDL_GL_CONTEXT_PROFILE_COMPATIBILITY : SDL_GL_CONTEXT_PROFILE_CORE;
SDL_GL_SetAttribute( SDL_GL_CONTEXT_MAJOR_VERSION, major );
SDL_GL_SetAttribute( SDL_GL_CONTEXT_MINOR_VERSION, minor );
@@ -41,7 +41,7 @@ void context_init( const char *title, int width, int height, int major, int mino
if( glewInitResult != GLEW_OK ) goto err;
#endif
s_controller = NULL;
s_controller = nullptr;
for( int i = 0; i < SDL_NumJoysticks(); ++i )
{
@@ -110,5 +110,5 @@ void context_terminate( void )
SDL_DestroyWindow( s_sdlWindow );
SDL_Quit();
s_sdlWindow = NULL;
s_sdlWindow = nullptr;
}
+1 -1
View File
@@ -94,7 +94,7 @@ static void load_mario_mesh( MarioMesh *mesh, struct SM64MarioGeometryBuffers *m
static void update_mario_mesh( MarioMesh *mesh, struct SM64MarioGeometryBuffers *marioGeo )
{
if( mesh->index == NULL )
if( mesh->index == nullptr )
load_mario_mesh( mesh, marioGeo );
mesh->num_vertices = 3 * marioGeo->numTrianglesUsed;
+4 -4
View File
@@ -156,7 +156,7 @@ static void load_collision_mesh( CollisionMesh *mesh )
glBindBuffer( GL_ARRAY_BUFFER, buff ); \
glBufferData( GL_ARRAY_BUFFER, mesh->num_vertices*sizeof( type ), arr, GL_STATIC_DRAW ); \
glEnableVertexAttribArray( loc ); \
glVertexAttribPointer( loc, sizeof( type ) / sizeof( float ), GL_FLOAT, GL_FALSE, sizeof( type ), NULL ); \
glVertexAttribPointer( loc, sizeof( type ) / sizeof( float ), GL_FLOAT, GL_FALSE, sizeof( type ), nullptr ); \
} while( 0 )
X( 0, mesh->position_buffer, mesh->position, vec3 );
@@ -181,7 +181,7 @@ static void load_mario_mesh( MarioMesh *mesh, struct SM64MarioGeometryBuffers *m
glBindBuffer( GL_ARRAY_BUFFER, buff ); \
glBufferData( GL_ARRAY_BUFFER, sizeof( type ) * 3 * SM64_GEO_MAX_TRIANGLES, arr, GL_DYNAMIC_DRAW ); \
glEnableVertexAttribArray( loc ); \
glVertexAttribPointer( loc, sizeof( type ) / sizeof( float ), GL_FLOAT, GL_FALSE, sizeof( type ), NULL ); \
glVertexAttribPointer( loc, sizeof( type ) / sizeof( float ), GL_FLOAT, GL_FALSE, sizeof( type ), nullptr ); \
} while( 0 )
X( 0, mesh->position_buffer, marioGeo->position, vec3 );
@@ -194,7 +194,7 @@ static void load_mario_mesh( MarioMesh *mesh, struct SM64MarioGeometryBuffers *m
static void update_mario_mesh( MarioMesh *mesh, struct SM64MarioGeometryBuffers *marioGeo )
{
if( mesh->index == NULL )
if( mesh->index == nullptr )
load_mario_mesh( mesh, marioGeo );
mesh->num_vertices = 3 * marioGeo->numTrianglesUsed;
@@ -228,7 +228,7 @@ static GLuint shader_compile( const char *shaderContents, size_t shaderContentsL
{
GLint maxLength;
glGetShaderiv( shader, GL_INFO_LOG_LENGTH, &maxLength );
char *log = (char*)malloc( maxLength );
char *log = malloc( maxLength );
glGetShaderInfoLog( shader, maxLength, &maxLength, log );
printf( "Error in shader: %s\n%s\n%s\n", log, shaderStrings[0], shaderStrings[1] );
+4 -4
View File
@@ -26,7 +26,7 @@ uint8_t *utils_read_file_alloc( const char *path, size_t *fileLength )
{
FILE *f = fopen( path, "rb" );
if( !f ) return NULL;
if( !f ) return nullptr;
fseek( f, 0, SEEK_END );
size_t length = (size_t)ftell( f );
@@ -73,7 +73,7 @@ int main( void )
uint8_t *rom = utils_read_file_alloc( "baserom.us.z64", &romSize );
if( rom == NULL )
if( rom == nullptr )
{
printf("\nFailed to read ROM file \"baserom.us.z64\"\n\n");
return 1;
@@ -94,7 +94,7 @@ int main( void )
free( rom );
RenderState renderState;
renderState.mario.index = NULL;
renderState.mario.index = nullptr;
vec3 cameraPos = { 0, 0, 0 };
float cameraRot = 0.0f;
@@ -144,7 +144,7 @@ int main( void )
if (!controller) // keyboard
{
const Uint8* state = SDL_GetKeyboardState(NULL);
const Uint8* state = SDL_GetKeyboardState(nullptr);
float dir;
float spd = 0;