Skip to content
Draft
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 4 additions & 0 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -29,6 +29,7 @@ bld/
[Bb]in/
[Oo]bj/
[Ll]og/
[Ll]ib/

# Visual Studio 2015/2017 cache/options directory
.vs/
Expand Down Expand Up @@ -349,6 +350,9 @@ Libraries
bin/
bin64/
bin32/
lib/
lib64/
lib32/
obj/
obj64/
obj32/
Expand Down
6 changes: 4 additions & 2 deletions Makefiles/Makefile.OSX
Original file line number Diff line number Diff line change
Expand Up @@ -74,9 +74,11 @@ endif
#

PLATFORM_CXXFLAGS = -F./Frameworks -IFrameworks/SDL2.framework/Headers $(SDL_CFLAGS) -DSUPERMODEL_OSX
PLATFORM_LDFLAGS = -F./Frameworks $(SDL_LIBS) -lz -lm -lstdc++ -Wl,-rpath,@executable_path/../Frameworks -Wl,-rpath,@executable_path/Frameworks
PLATFORM_LDFLAGS = -F./Frameworks $(SDL_LIBS) -lz -lm -lstdc++ -Wl,-rpath,@executable_path/../Frameworks -Wl,-rpath,@executable_path/Frameworks -Wl,-rpath,@loader_path
PLATFORM_DIRS = Frameworks/SDL2_net.framework Frameworks/SDL2.framework
PLATFORM_BINARY_EXTENSION =
PLATFORM_DYLIB_EXTENSION = .dylib
PLATFORM_DYLIB_FLAG = -dylib

#
# GitHub token
Expand Down Expand Up @@ -151,4 +153,4 @@ Frameworks/SDL2_net.framework: Frameworks/SDL2_net.dmg
$(SILENT)cp -r /Volumes/SDL2_net/SDL2_net.framework Frameworks
$(SILENT)xattr -dr com.apple.quarantine $@
$(SILENT)hdiutil detach -quiet /Volumes/SDL2_net
$(SILENT)touch $@
$(SILENT)touch $@
3 changes: 2 additions & 1 deletion Makefiles/Makefile.UNIX
Original file line number Diff line number Diff line change
Expand Up @@ -75,7 +75,8 @@ endif
PLATFORM_CXXFLAGS = $(SDL2_CFLAGS) -O3
PLATFORM_LDFLAGS = $(SDL2_LIBS) -lGL -lGLU -lz -lm -lstdc++ -lpthread
PLATFORM_BINARY_EXTENSION =

PLATFORM_DYLIB_EXTENSION = .so
PLATFORM_DYLIB_FLAG = --shared

###############################################################################
# Core Makefile
Expand Down
3 changes: 2 additions & 1 deletion Makefiles/Makefile.Win32
Original file line number Diff line number Diff line change
Expand Up @@ -109,7 +109,8 @@ PLATFORM_LIBS = -ldxerr8 -ldinput8 -lglu32 -lole32 -loleaut32 -lopengl32 -lwbemu
PLATFORM_CXXFLAGS = $(SDL2_CFLAGS) -DSUPERMODEL_WIN32 $(addprefix -I,$(sort $(PLATFORM_INCLUDE_DIR)))
PLATFORM_LDFLAGS = -static -L$(sort $(PLATFORM_LIB_DIR)) $(SDL2_LIBS) $(PLATFORM_LIBS)
PLATFORM_BINARY_EXTENSION = .exe

PLATFORM_DYLIB_EXTENSION = .dll
PLATFORM_DYLIB_FLAG = --shared

###############################################################################
# Core Makefile
Expand Down
39 changes: 37 additions & 2 deletions Makefiles/Rules.inc
Original file line number Diff line number Diff line change
Expand Up @@ -32,9 +32,11 @@

OBJ_DIR = obj$(strip $(BITS))
BIN_DIR = bin$(strip $(BITS))
LIB_DIR = lib$(strip $(BITS))

SUPERMODEL_BINARY = supermodel$(PLATFORM_BINARY_EXTENSION)
DISASSEMBLER_BINARY = ppcd$(PLATFORM_BINARY_EXTENSION)
SUPERMODEL_DYLIB = supermodel_libretro$(PLATFORM_DYLIB_EXTENSION)


###############################################################################
Expand Down Expand Up @@ -62,6 +64,11 @@ ifeq ($(strip $(ENABLE_DEBUGGER)),1)
SUPERMODEL_BUILD_FLAGS += -DSUPERMODEL_DEBUGGER
endif

# If libretro enabled, need to define SUPERMODEL_LIBRETRO
ifeq ($(strip $(LIBRETRO)),1)
SUPERMODEL_BUILD_FLAGS += -DSUPERMODEL_LIBRETRO
endif

# DEBUG will build a debug build but does *not* enable extra debug logging and
# therefore does not modify SUPERMODEL_BUILD_FLAGS

Expand All @@ -87,8 +94,11 @@ endif
COMMON_CFLAGS = -c $(ARCH) $(OPT) $(WARN) $(addprefix -I,$(sort $(INCLUDE_DIRS))) -DGLEW_STATIC $(SUPERMODEL_BUILD_FLAGS)
CFLAGS = $(COMMON_CFLAGS) $(CSTD)
CXXFLAGS = $(PLATFORM_CXXFLAGS) $(COMMON_CFLAGS) $(CXXSTD)
ifeq ($(strip $(LIBRETRO)),1)
LDFLAGS = $(PLATFORM_DYLIB_FLAG) -o $(LIB_DIR)/$(SUPERMODEL_DYLIB) $(PLATFORM_LDFLAGS) $(LDOPT)
else
LDFLAGS = -o $(BIN_DIR)/$(SUPERMODEL_BINARY) $(PLATFORM_LDFLAGS) $(LDOPT)

endif

###############################################################################
# Source Files
Expand Down Expand Up @@ -207,6 +217,11 @@ ifeq ($(strip $(ENABLE_DEBUGGER)),1)
Src/Debugger/CPU/Z80Debug.cpp
endif

ifeq ($(strip $(LIBRETRO)),1)
SRC_FILES += \
Src/OSD/SDL/LibRetro.cpp
endif

#
# Sorted-path compile order
#
Expand All @@ -228,7 +243,11 @@ INCLUDE_DIRS = $(sort $(foreach file,$(SRC_FILES),$(dir $(file))))
# generated dependencies because otherwise, make gets confused for some reason
# and thinks the default target is just one of the object files.
#
ifeq ($(strip $(LIBRETRO)),1)
all: $(LIB_DIR)/$(SUPERMODEL_DYLIB)
else
all: $(BIN_DIR)/$(DISASSEMBLER_BINARY) $(BIN_DIR)/$(SUPERMODEL_BINARY)
endif

#
# Supermodel3.com release targets: used only to create official builds stamped
Expand Down Expand Up @@ -314,7 +333,7 @@ $(BIN_DIR)/$(SUPERMODEL_BINARY): $(BIN_DIR) $(OBJ_FILES)

#
# Disassembler binary (we assume $(LD) can also compile here, which is sloppy).
# $(PLATFORM_DIRS) is required on macOS, whose $(PLATFORM_LDFLAGS) pulls in
# $(PLATFORM_DIRS) is required on macOS, whose $(PLATFORM_LDFLAGS) pulls in
# Frameworks that must be downloaded.
#
$(BIN_DIR)/$(DISASSEMBLER_BINARY): $(BIN_DIR) Src/CPU/PowerPC/PPCDisasm.cpp $(PLATFORM_DIRS)
Expand All @@ -323,6 +342,15 @@ $(BIN_DIR)/$(DISASSEMBLER_BINARY): $(BIN_DIR) Src/CPU/PowerPC/PPCDisasm.cpp $(P
$(SILENT)$(LD) -o $(BIN_DIR)/$(DISASSEMBLER_BINARY) Src/CPU/PowerPC/PPCDisasm.cpp -DSTANDALONE $(OPT) $(WARN) $(addprefix -I,$(sort $(INCLUDE_DIRS))) $(CXXSTD) $(PLATFORM_LDFLAGS)
$(info --------------------------------------------------------------------------------)

#
# Supermodel dylib
#
$(LIB_DIR)/$(SUPERMODEL_DYLIB): $(LIB_DIR) $(OBJ_FILES)
$(info --------------------------------------------------------------------------------)
$(info Dynamic Linking Supermodel : $(LIB_DIR)/$(SUPERMODEL_DYLIB))
$(LD) $(OBJ_FILES) $(LDFLAGS)
$(info --------------------------------------------------------------------------------)

#
# Directory to which binary will be written. Note that Supermodel is never
# packaged with this directory.
Expand All @@ -338,6 +366,13 @@ $(OBJ_DIR): | $(PLATFORM_DIRS)
$(info Creating directory : $(OBJ_DIR))
$(SILENT)mkdir $(OBJ_DIR)

#
# Library directory
#
$(LIB_DIR): | $(PLATFORM_DIRS)
$(info Creating directory : $(LIB_DIR))
$(SILENT)mkdir $(LIB_DIR)


###############################################################################
# Rules
Expand Down
9 changes: 7 additions & 2 deletions Src/OSD/Logger.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -210,19 +210,24 @@ void CConsoleErrorLogger::DebugLog(const char *fmt, va_list vl)
{
// To view debug-level logging on the console, use a file logger writing
// to stdout
//ErrorLog(fmt, vl);
}

void CConsoleErrorLogger::InfoLog(const char *fmt, va_list vl)
{
// To view info-level logging on the console, use a file logger writing
// to stdout
ErrorLog(fmt, vl);
}

void CConsoleErrorLogger::ErrorLog(const char *fmt, va_list vl)
{
char string[4096];
vsnprintf(string, sizeof(string), fmt, vl);
fprintf(stderr, "Error: %s\n", string);
int out = vsnprintf(string, sizeof(string), fmt, vl);
fprintf(stderr, "SM: %s", string);
if (string[out-1] != '\n') {
fprintf(stderr, "\n");
}
}

/*
Expand Down
6 changes: 4 additions & 2 deletions Src/OSD/SDL/Audio.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -86,8 +86,8 @@ static int bytes_per_sample_host = BYTES_PER_SAMPLE_M3;
static int bytes_per_frame_host = BYTES_PER_FRAME_M3;

// Balance percents for mixer
float BalanceLeftRight = 0; // 0 mid balance, 100: left only, -100:right only
float BalanceFrontRear = 0; // 0 mid balance, 100: front only, -100:right only
float BalanceLeftRight = 0; // 0 mid balance, 100: left only, -100:right only
float BalanceFrontRear = 0; // 0 mid balance, 100: front only, -100:right only
// Mixer factor (depends on values above)
float balanceFactorFrontLeft = 1.0f;
float balanceFactorFrontRight = 1.0f;
Expand Down Expand Up @@ -529,6 +529,7 @@ Result OpenAudio(const Util::Config::Node& config)
return Result::OKAY;
}

#ifndef SUPERMODEL_LIBRETRO
bool OutputAudio(unsigned numSamples, const float* leftFrontBuffer, const float* rightFrontBuffer, const float* leftRearBuffer, const float* rightRearBuffer, bool flipStereo)
{
//printf("OutputAudio(%u) [writePos = %u, writeWrapped = %s, playPos = %u, audioBufferSize = %u]\n",
Expand Down Expand Up @@ -676,6 +677,7 @@ bool OutputAudio(unsigned numSamples, const float* leftFrontBuffer, const float*
// Return whether buffer is half full
return bufferFull;
}
#endif

void CloseAudio()
{
Expand Down
Loading