Skip to content

Commit

Permalink
Add RMODERN build option, main function
Browse files Browse the repository at this point in the history
  • Loading branch information
giraffeics committed Aug 10, 2020
1 parent c9fe88e commit e2aeb12
Show file tree
Hide file tree
Showing 4 changed files with 56 additions and 0 deletions.
21 changes: 21 additions & 0 deletions Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -65,6 +65,9 @@ AUDIO_API ?= SDL2
# Controller backends (can have multiple, space separated): SDL2
CONTROLLER_API ?= SDL2

# Modern rendering system (will eventually replace other backends)
RMODERN ?= 0

# Misc settings for EXTERNAL_DATA

BASEDIR ?= res
Expand Down Expand Up @@ -255,6 +258,14 @@ else
BUILD_DIR := $(BUILD_DIR_BASE)/$(VERSION)_pc
endif

ifeq ($(DEBUG),1)
BUILD_DIR := $(BUILD_DIR)_debug
endif

ifeq ($(RMODERN),1)
BUILD_DIR := $(BUILD_DIR)_rmodern
endif

LIBULTRA := $(BUILD_DIR)/libultra.a

ifeq ($(TARGET_WEB),1)
Expand Down Expand Up @@ -286,6 +297,10 @@ LEVEL_DIRS := $(patsubst levels/%,%,$(dir $(wildcard levels/*/header.h)))
SRC_DIRS := src src/engine src/game src/audio src/menu src/buffers actors levels bin data assets src/pc src/pc/gfx src/pc/audio src/pc/controller src/pc/fs src/pc/fs/packtypes
ASM_DIRS :=

ifeq ($(RMODERN),1)
SRC_DIRS += src/pc/rmodern
endif

ifeq ($(DISCORDRPC),1)
SRC_DIRS += src/pc/discord
endif
Expand Down Expand Up @@ -478,6 +493,12 @@ SDLCONFIG := $(CROSS)sdl2-config
# configure backend flags

BACKEND_CFLAGS := -DRAPI_$(RENDER_API)=1 -DWAPI_$(WINDOW_API)=1 -DAAPI_$(AUDIO_API)=1

# rmodern
ifeq ($(RMODERN),1)
BACKEND_CFLAGS += -DRMODERN
endif

# can have multiple controller APIs
BACKEND_CFLAGS += $(foreach capi,$(CONTROLLER_API),-DCAPI_$(capi)=1)
BACKEND_LDFLAGS :=
Expand Down
9 changes: 9 additions & 0 deletions src/pc/pc_main.c
Original file line number Diff line number Diff line change
Expand Up @@ -171,6 +171,14 @@ static void on_anim_frame(double time) {
}
#endif


#ifdef RMODERN
#include "rmodern/rmodern.h"
void main_func(void)
{
rmodern_init();
}
#else
void main_func(void) {
static u64 pool[0x165000/8 / 4 * sizeof(void *)];
main_pool_init(pool, pool + sizeof(pool) / sizeof(pool[0]));
Expand Down Expand Up @@ -261,6 +269,7 @@ void main_func(void) {
}
#endif
}
#endif

int main(int argc, char *argv[]) {
parse_cli_opts(argc, argv);
Expand Down
18 changes: 18 additions & 0 deletions src/pc/rmodern/rmodern.h
Original file line number Diff line number Diff line change
@@ -0,0 +1,18 @@
/**
* This header file provides the interface between modern rendering functionality,
* written in C++, and the rest of the codebase.
*/

#ifndef RMODERN_H
#define RMODERN_H
#ifdef __cplusplus
extern "C"
{
#endif

void rmodern_init();

#ifdef __cplusplus
}
#endif
#endif
8 changes: 8 additions & 0 deletions src/pc/rmodern/rmodern_main.cpp
Original file line number Diff line number Diff line change
@@ -0,0 +1,8 @@
#include "rmodern.h"

#include <iostream>

void rmodern_init()
{
std::cout << "Hello, world!! ^-^" << std::endl;
}

0 comments on commit e2aeb12

Please sign in to comment.