almost ready

This commit is contained in:
Jeffrey Crowell 2022-05-16 13:11:07 -04:00
commit f5af934528
12 changed files with 45 additions and 17 deletions

View file

@ -47,7 +47,10 @@ endif
# CXXFLAGS += -DTEXTURE_DEBUG # CXXFLAGS += -DTEXTURE_DEBUG
LDFLAGS := -lm -ldl -lpng \ LDFLAGS := -lm -ldl -lpng \
-L../external -L../libultraship -lz -lbz2 -pthread -lpulse -lultraship -lstorm -lSDL2 $(shell pkg-config --libs glew) -lX11 -L../external -L../libultraship -lz -lbz2 -pthread -lpulse -lultraship -lstorm $(shell pkg-config --libs glew x11 libpng) $(shell sdl2-config --libs)
# Use LLD if available. Set LLD=0 to not use it # Use LLD if available. Set LLD=0 to not use it
ifeq ($(shell command -v ld.lld >/dev/null 2>&1; echo $$?),0) ifeq ($(shell command -v ld.lld >/dev/null 2>&1; echo $$?),0)

View file

@ -18,7 +18,7 @@ WARN := -Wall -Wextra -Werror \
-Wno-narrowing \ -Wno-narrowing \
-Wno-missing-field-initializers -Wno-missing-field-initializers
CXXFLAGS := $(WARN) -std=c++20 -D_GNU_SOURCE -DENABLE_OPENGL -DSPDLOG_ACTIVE_LEVEL=0 CXXFLAGS := $(WARN) -std=c++20 -D_GNU_SOURCE -DENABLE_OPENGL -DSPDLOG_ACTIVE_LEVEL=0 -Wno-deprecated-enum-enum-conversion
CFLAGS := $(WARN) -std=c99 -D_GNU_SOURCE -DENABLE_OPENGL -DSPDLOG_ACTIVE_LEVEL=0 CFLAGS := $(WARN) -std=c99 -D_GNU_SOURCE -DENABLE_OPENGL -DSPDLOG_ACTIVE_LEVEL=0
CPPFLAGS := -MMD $(shell pkg-config --cflags sdl2 glew) CPPFLAGS := -MMD $(shell pkg-config --cflags sdl2 glew)

View file

@ -280,7 +280,11 @@ static struct ShaderProgram* gfx_opengl_create_and_load_new_shader(uint64_t shad
append_line(vs_buf, &vs_len, "}"); append_line(vs_buf, &vs_len, "}");
// Fragment shader // Fragment shader
#ifdef __APPLE__
append_line(fs_buf, &fs_len, "#version 130"); append_line(fs_buf, &fs_len, "#version 130");
#else
append_line(fs_buf, &fs_len, "#version 130");
#endif
//append_line(fs_buf, &fs_len, "precision mediump float;"); //append_line(fs_buf, &fs_len, "precision mediump float;");
for (int i = 0; i < 2; i++) { for (int i = 0; i < 2; i++) {
if (cc_features.used_textures[i]) { if (cc_features.used_textures[i]) {
@ -435,9 +439,9 @@ static struct ShaderProgram* gfx_opengl_create_and_load_new_shader(uint64_t shad
GLint max_length = 0; GLint max_length = 0;
glGetShaderiv(vertex_shader, GL_INFO_LOG_LENGTH, &max_length); glGetShaderiv(vertex_shader, GL_INFO_LOG_LENGTH, &max_length);
char error_log[1024]; char error_log[1024];
//fprintf(stderr, "Vertex shader compilation failed\n"); fprintf(stderr, "Vertex shader compilation failed\n");
glGetShaderInfoLog(vertex_shader, max_length, &max_length, &error_log[0]); glGetShaderInfoLog(vertex_shader, max_length, &max_length, &error_log[0]);
//fprintf(stderr, "%s\n", &error_log[0]); fprintf(stderr, "%s\n", &error_log[0]);
abort(); abort();
} }

View file

@ -126,7 +126,7 @@ struct ImGui_ImplGlfw_Data
GLFWcharfun PrevUserCallbackChar; GLFWcharfun PrevUserCallbackChar;
GLFWmonitorfun PrevUserCallbackMonitor; GLFWmonitorfun PrevUserCallbackMonitor;
ImGui_ImplGlfw_Data() { memset(this, 0, sizeof(*this)); } ImGui_ImplGlfw_Data() { /*memset(this, 0, sizeof(*this));*/ }
}; };
// Backend data stored in io.BackendPlatformUserData to allow support for multiple Dear ImGui contexts // Backend data stored in io.BackendPlatformUserData to allow support for multiple Dear ImGui contexts

View file

@ -216,11 +216,11 @@ bool ImGui_ImplOpenGL3_Init(const char* glsl_version)
IM_ASSERT(io.BackendRendererUserData == NULL && "Already initialized a renderer backend!"); IM_ASSERT(io.BackendRendererUserData == NULL && "Already initialized a renderer backend!");
// Initialize our loader // Initialize our loader
#if !defined(IMGUI_IMPL_OPENGL_ES2) && !defined(IMGUI_IMPL_OPENGL_ES3) && !defined(IMGUI_IMPL_OPENGL_LOADER_CUSTOM) #if !defined(IMGUI_IMPL_OPENGL_ES2) && !defined(IMGUI_IMPL_OPENGL_ES3) && !defined(IMGUI_IMPL_OPENGL_LOADER_CUSTOM) || 0
if (imgl3wInit() != 0) if (imgl3wInit() != 0)
{ {
fprintf(stderr, "Failed to initialize OpenGL loader!\n"); fprintf(stderr, "Failed to initialize OpenGL loader!\n");
return false; // return false;
} }
#endif #endif
@ -254,7 +254,7 @@ bool ImGui_ImplOpenGL3_Init(const char* glsl_version)
// Store GLSL version string so we can refer to it later in case we recreate shaders. // Store GLSL version string so we can refer to it later in case we recreate shaders.
// Note: GLSL version is NOT the same as GL version. Leave this to NULL if unsure. // Note: GLSL version is NOT the same as GL version. Leave this to NULL if unsure.
if (glsl_version == NULL) if (glsl_version == NULL || true)
{ {
#if defined(IMGUI_IMPL_OPENGL_ES2) #if defined(IMGUI_IMPL_OPENGL_ES2)
glsl_version = "#version 100"; glsl_version = "#version 100";

View file

@ -153,7 +153,11 @@ namespace SohImGui {
void ImGuiBackendInit() { void ImGuiBackendInit() {
switch (impl.backend) { switch (impl.backend) {
case Backend::SDL: case Backend::SDL:
#if __APPLE__
ImGui_ImplOpenGL3_Init("#version 120"); ImGui_ImplOpenGL3_Init("#version 120");
#else
ImGui_ImplOpenGL3_Init("#version 120");
#endif
break; break;
#if defined(ENABLE_DX11) || defined(ENABLE_DX12) #if defined(ENABLE_DX11) || defined(ENABLE_DX12)

3
soh/.gitignore vendored
View file

@ -18,6 +18,7 @@ notes/
baserom/ baserom/
docs/doxygen/ docs/doxygen/
*.elf *.elf
*.arm64
*.sra *.sra
*.z64 *.z64
*.n64 *.n64
@ -404,4 +405,4 @@ ZAPD/BuildInfo.h
cvars.cfg cvars.cfg
DebugObj/* DebugObj/*
ReleaseObj/* ReleaseObj/*

View file

@ -16,10 +16,10 @@ LTO ?= 0
WARN := \ WARN := \
-Wno-return-type \ -Wno-return-type \
-funsigned-char \ -funsigned-char \
-mhard-float -fno-stack-protector -fno-common -fno-zero-initialized-in-bss -fno-strict-aliasing -fno-inline-functions -fno-inline-small-functions -fno-toplevel-reorder -ffreestanding -fwrapv \ -fno-stack-protector -fno-common -fno-zero-initialized-in-bss -fno-strict-aliasing -fno-inline-functions -fno-inline-small-functions -fno-toplevel-reorder -ffreestanding -fwrapv \
CXXFLAGS := $(WARN) -std=c++20 -D_GNU_SOURCE -fpermissive -no-pie -nostdlib -march=i386 CXXFLAGS := $(WARN) -std=c++20 -D_GNU_SOURCE -fpermissive -no-pie -nostdlib $(shell pkg-config --cflags sdl2 x11)
CFLAGS := $(WARN) -std=c99 -D_GNU_SOURCE -no-pie -nostdlib -march=i386 CFLAGS := $(WARN) -std=c99 -D_GNU_SOURCE -no-pie -nostdlib $(shell pkg-config --cflags sdl2 x11)
LDFLAGS := LDFLAGS :=
CPPFLAGS := -MMD CPPFLAGS := -MMD
@ -28,6 +28,9 @@ ifneq ($(DEBUG),0)
CFLAGS += -g CFLAGS += -g
endif endif
CXXFLAGS += -g
CFLAGS += -g
ifneq ($(ASAN),0) ifneq ($(ASAN),0)
CXXFLAGS += -fsanitize=address CXXFLAGS += -fsanitize=address
LDFLAGS += -fsanitize=address LDFLAGS += -fsanitize=address
@ -38,7 +41,7 @@ ifneq ($(LTO),0)
LDFLAGS += -flto LDFLAGS += -flto
endif endif
TARGET := soh.elf TARGET := soh.arm64
INC_DIRS := $(addprefix -I, \ INC_DIRS := $(addprefix -I, \
. \ . \
@ -51,11 +54,16 @@ INC_DIRS := $(addprefix -I, \
../libultraship/libultraship/Lib/spdlog/include \ ../libultraship/libultraship/Lib/spdlog/include \
../libultraship/libultraship/Lib/Fast3D/U64 \ ../libultraship/libultraship/Lib/Fast3D/U64 \
../libultraship/libultraship/Lib/Fast3D/U64/PR \ ../libultraship/libultraship/Lib/Fast3D/U64/PR \
/opt/X11/include \
) )
CFLAGS := $(CFLAGS) $(shell sdl2-config --cflags) $(shell pkg-config --cflags glew)
CXXFLAGS := $(CXXFLAGS) $(shell sdl2-config --cflags) $(shell pkg-config --cflags glew)
LDDIRS := $(addprefix -L, \ LDDIRS := $(addprefix -L, \
../external \ ../external \
../libultraship/ \ ../libultraship/ \
/opt/X11/lib \
) )
LDLIBS := \ LDLIBS := \
@ -67,14 +75,13 @@ LDLIBS := \
z \ z \
pthread \ pthread \
atomic \ atomic \
SDL2 \
GL \ GL \
GLEW \
storm \ storm \
pulse\
ultraship \ ultraship \
) \ ) \
LDLIBS := $(LDLIBS) $(shell sdl2-config --libs) $(shell pkg-config --libs glew)
ASSET_BIN_DIRS := $(shell find assets/* -type d -not -path "assets/xml*") ASSET_BIN_DIRS := $(shell find assets/* -type d -not -path "assets/xml*")
ASSET_FILES_XML := $(foreach dir,$(ASSET_BIN_DIRS),$(wildcard $(dir)/*.xml)) ASSET_FILES_XML := $(foreach dir,$(ASSET_BIN_DIRS),$(wildcard $(dir)/*.xml))
ASSET_FILES_BIN := $(foreach dir,$(ASSET_BIN_DIRS),$(wildcard $(dir)/*.bin)) ASSET_FILES_BIN := $(foreach dir,$(ASSET_BIN_DIRS),$(wildcard $(dir)/*.bin))

View file

@ -60,7 +60,9 @@ void Locale_ResetRegion(void);
u32 func_80001F48(void); u32 func_80001F48(void);
u32 func_80001F8C(void); u32 func_80001F8C(void);
u32 Locale_IsRegionNative(void); u32 Locale_IsRegionNative(void);
#ifndef __APPLE__
void __assert(const char* exp, const char* file, s32 line); void __assert(const char* exp, const char* file, s32 line);
#endif
void isPrintfInit(void); void isPrintfInit(void);
void osSyncPrintfUnused(const char* fmt, ...); void osSyncPrintfUnused(const char* fmt, ...);
//void osSyncPrintf(const char* fmt, ...); //void osSyncPrintf(const char* fmt, ...);

View file

@ -495,7 +495,7 @@ typedef enum {
/* 0x72 */ GID_BULLET_BAG_50, /* 0x72 */ GID_BULLET_BAG_50,
/* 0x73 */ GID_SWORD_KOKIRI, /* 0x73 */ GID_SWORD_KOKIRI,
/* 0x74 */ GID_SKULL_TOKEN_2, /* 0x74 */ GID_SKULL_TOKEN_2,
/* 0x75 */ GID_MAX /* 0x75 */ GID_MAXIMUM
} GetItemDrawID; } GetItemDrawID;
typedef enum { typedef enum {

View file

@ -35,7 +35,12 @@
#include "macros.h" #include "macros.h"
#include <Utils/StringHelper.h> #include <Utils/StringHelper.h>
#ifdef __APPLE__
#include <SDL_scancode.h>
#else
#include <SDL2/SDL_scancode.h> #include <SDL2/SDL_scancode.h>
#endif
OTRGlobals* OTRGlobals::Instance; OTRGlobals* OTRGlobals::Instance;

View file

@ -1,6 +1,8 @@
#include "z64.h" #include "z64.h"
#include <assert.h> #include <assert.h>
#ifndef __APPLE__
#include <malloc.h> #include <malloc.h>
#endif
#ifndef _MSC_VER #ifndef _MSC_VER
#include <unistd.h> #include <unistd.h>