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
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
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-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
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, "}");
// Fragment shader
#ifdef __APPLE__
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;");
for (int i = 0; i < 2; 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;
glGetShaderiv(vertex_shader, GL_INFO_LOG_LENGTH, &max_length);
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]);
//fprintf(stderr, "%s\n", &error_log[0]);
fprintf(stderr, "%s\n", &error_log[0]);
abort();
}

View file

@ -126,7 +126,7 @@ struct ImGui_ImplGlfw_Data
GLFWcharfun PrevUserCallbackChar;
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

View file

@ -216,11 +216,11 @@ bool ImGui_ImplOpenGL3_Init(const char* glsl_version)
IM_ASSERT(io.BackendRendererUserData == NULL && "Already initialized a renderer backend!");
// 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)
{
fprintf(stderr, "Failed to initialize OpenGL loader!\n");
return false;
// return false;
}
#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.
// 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)
glsl_version = "#version 100";

View file

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

1
soh/.gitignore vendored
View file

@ -18,6 +18,7 @@ notes/
baserom/
docs/doxygen/
*.elf
*.arm64
*.sra
*.z64
*.n64

View file

@ -16,10 +16,10 @@ LTO ?= 0
WARN := \
-Wno-return-type \
-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
CFLAGS := $(WARN) -std=c99 -D_GNU_SOURCE -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 $(shell pkg-config --cflags sdl2 x11)
LDFLAGS :=
CPPFLAGS := -MMD
@ -28,6 +28,9 @@ ifneq ($(DEBUG),0)
CFLAGS += -g
endif
CXXFLAGS += -g
CFLAGS += -g
ifneq ($(ASAN),0)
CXXFLAGS += -fsanitize=address
LDFLAGS += -fsanitize=address
@ -38,7 +41,7 @@ ifneq ($(LTO),0)
LDFLAGS += -flto
endif
TARGET := soh.elf
TARGET := soh.arm64
INC_DIRS := $(addprefix -I, \
. \
@ -51,11 +54,16 @@ INC_DIRS := $(addprefix -I, \
../libultraship/libultraship/Lib/spdlog/include \
../libultraship/libultraship/Lib/Fast3D/U64 \
../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, \
../external \
../libultraship/ \
/opt/X11/lib \
)
LDLIBS := \
@ -67,14 +75,13 @@ LDLIBS := \
z \
pthread \
atomic \
SDL2 \
GL \
GLEW \
storm \
pulse\
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_FILES_XML := $(foreach dir,$(ASSET_BIN_DIRS),$(wildcard $(dir)/*.xml))
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_80001F8C(void);
u32 Locale_IsRegionNative(void);
#ifndef __APPLE__
void __assert(const char* exp, const char* file, s32 line);
#endif
void isPrintfInit(void);
void osSyncPrintfUnused(const char* fmt, ...);
//void osSyncPrintf(const char* fmt, ...);

View file

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

View file

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

View file

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